0

What's wrong? The output should be hihihihihi

x =str( input("hi")) y =int(input(5)) print (x*y)

8th Jul 2022, 8:13 AM
Zynab Naser
8 Answers
+ 10
Zynab Naser You are emplacing your variable within an input prompt, which is causing the error. If you wish to use variables: x = "hi" y = 5 print(x*y) If you wish to use inputs x = input() # string y = int(input()) # integer print(x*y)
8th Jul 2022, 8:21 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
Zynab Naser x = "hi" y = int(input()) print(x*y) x & y are both variables which contain values. input is merely a value which is determined by the user. So if one variable is required to be prestated, then state the value of the variable.
8th Jul 2022, 8:47 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
How can l solve an defined variable hi
8th Jul 2022, 8:35 AM
Zynab Naser
+ 1
Zynab Naser Try This - x = input() y = int(input()) print(x*y) This will solve your issues. For defining a variable you can omit the input part and mention the value. Like - x = "SDB-" y = int(input()) print(x*y)
8th Jul 2022, 11:44 PM
Santtosh Jha
Santtosh Jha - avatar
+ 1
Zynab Naser not sure but try removing between the last 2 brackets ) ). I've tried through mobile ide and through online interpreter and it works just fine.
9th Jul 2022, 7:49 AM
Santtosh Jha
Santtosh Jha - avatar
+ 1
SymbolsOrganized Review my answer in this thread
15th Dec 2022, 9:27 PM
Rik Wittkopp
Rik Wittkopp - avatar
0
x = input ("hi") y = int(input(5) ) print(x*y) I just wrote it like this and it didn't work. What is the wrong
9th Jul 2022, 7:47 AM
Zynab Naser
0
I am a beginner but this beginning exercise has me confused please help... x = ("hi") y = int((5)) print (x*y) results in zero ability to move forward... I used your code vs my code... x = ("hi") y= (x*4) print (y) both results in hihihihihi change the numbers when using the word python... still nothing... What am I doing wrong....
15th Dec 2022, 2:06 PM
SymbolsOrganized