Section 15.2 results in undefined variable | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Section 15.2 results in undefined variable

Hey! I’m trying to use inputs to create the phrase “hihihi.” But I keep getting an “undefined variable response for x. I cannot for my life figure out what’s wrong. Any chance any of you might be willing to help an utter newb? Here’s my code: x=input("hi") y=int(input(3)) print(x*y) Thanks!

5th Feb 2022, 12:46 PM
Josh05
4 Answers
+ 3
Josh05 No as there is input so you should use input function but without passing any argument. x = input() y = int(input() print (x * y)
5th Feb 2022, 12:57 PM
A͢J
A͢J - avatar
+ 2
joshua Meyers Don't write anything inside input() function
5th Feb 2022, 12:49 PM
A͢J
A͢J - avatar
+ 1
Thanks! So, should the code just read: X=“hi” Y=int(3) Print(x*y) Thanks!
5th Feb 2022, 12:52 PM
Josh05
0
I’m an idiot. Thanks so much—i really appreciate it!
5th Feb 2022, 1:01 PM
Josh05