+ 2
How do you define a function while calling for user input?? I need to solve this, I'm a beginner to Python
Define yell_this() and call with variable argument define variable words_to_yell as a string gathered from user input() Call yell_this() with words_to_yell as argument get user input() for the string words_to_yell # [ ] define yell_this() # [ ] get user input in variable words_to_yell # [ ] call yell_this function with words_to_yell as argument I've tried various methods: ____ def yell_this(): words_to_yell = input("enter words to yell: ") yell_this(words_to_yell) ____ HELP PLEASE!!
2 odpowiedzi
+ 3
while calling a function with argument(actual arg) , function definition should also have argument(formal arg).so just modify your code as follows:
def yell_this (words_to_yell):
words_to_yell=input("enter words to yell:")
print(words_to_yell)
words_to_yell=1 #any default value
yell_this(words_to_yell)
https://code.sololearn.com/cqhvGkjkSMx1/?ref=app
0
Thanks! big help