How can I use a variable as an argument or parameter in a function? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

How can I use a variable as an argument or parameter in a function?

So basically I wanna declare a variable, then put it through a function as input, then output a string of text based on whether its odd or even. n = input(int()) def function(n): if (n % 2) == 0 in range(2, 5): print("Not Weird") else: print("Weird") return

12th Dec 2021, 1:40 AM
Babydoll Scripts
Babydoll Scripts - avatar
2 Respostas
+ 2
Babydoll Scripts , there are some issues in the code. see my comments in the attached file: https://code.sololearn.com/c7QsZoxAHqq5/?ref=app
12th Dec 2021, 10:32 AM
Lothar
Lothar - avatar
0
call your function using that same variable as a argument. function(n)
12th Dec 2021, 2:32 AM
zexu knub
zexu knub - avatar