You probably did not fully understand the function of the function. In case it executes something and discards any information obtained in it. If you want a value obtained within the function to be delivered where the function is called, you must use the return
command. It has two capabilities: it terminates the execution flow of the function (it is true that without it it also terminates at the end of the definition of the function code, so it is only mandatory to terminate if it needs to do before the end, conditionally, of course); and it also allows you to return something, that is, to return a value that you will determine soon after, and of course that if you need to return a value the return
is mandatory, even to specify what that value, then only return
is missing.
def funcao():
return int(input('insira um número:'))
tupla = (funcao(), funcao(), funcao(), funcao())
print(tupla.count(9))
print(tupla)
See running on ideone . And no Coding Ground . Also I put GitHub for future reference .
Could also have done without the function:
tupla = (int(input('insira um número:')), int(input('insira um número:')), int(input('insira um número:')), int(input('insira um número:')))