0

Iā€™m beginner and whatā€™s wrong in this code

X=input (ā€œhiā€) Y=int(input (3)) Print (x*y) Output is hi I wanted to be hihihi

12th Jun 2022, 7:23 PM
Mehrad Nejad
Mehrad Nejad - avatar
7 Answers
0
# Hi! You can try this: name = input("Input your name: ") print() n = int(input("The number of repetitions: ")) print() print(n * (name + ", "))
13th Jun 2022, 5:56 AM
Per Bratthammar
Per Bratthammar - avatar
+ 9
If you are referring to a sololearn code project: DO NOT WRITE ANYTHING INSIDE THE INPUT FUNCTION. x = input(), not x = input("hi") and so on Please check the spelling before you post your code.
12th Jun 2022, 7:53 PM
Lisa
Lisa - avatar
+ 7
I would recommend removing the input function. Try just doing x = "hi" y = 3 There's not real purpose in using the input function if you do not want outside user input and are okay with pre-declaring the word you would like to use.
12th Jun 2022, 7:39 PM
Justice
Justice - avatar
+ 4
Mehrad Nejad you should only use input method only when you want the to take user input otherwise don't use it. input() šŸ‘ˆšŸ‘ˆ only for taking input and if you want to take user input and prompt a message for the user at the same time then you should use input("your message") šŸ‘ˆšŸ‘ˆ but if you want to just prompt a message then use print("your message") šŸ‘ˆšŸ‘ˆšŸ‘ˆ
13th Jun 2022, 2:58 AM
NonStop CODING
NonStop CODING - avatar
+ 1
<<ā—ļøPLEASE READ PROBLEM 2 FIRSTā—ļø>> 1. Why donā€™t you write ā€˜y=3ā€™ instead of ā€˜y=int(input(3))ā€™? Try it! It would be much easier! (same problem with x) 2. No ā€˜intā€™ing integers because itā€™s already an integer. (btw ā€˜intā€™ means integer) So it will cause an error so python will ignore the variable and DELETE the variable so it means ā€˜x(ā€˜hiā€™)*y(deleted/ignored so itā€™s a ā€˜*1ā€™), making the output ā€˜hiā€™.
14th Jun 2022, 11:21 AM
黃ęƅę™ŗ4A26
黃ęƅę™ŗ4A26 - avatar
0
The input(3) gets user input and you already know your input to be 3
14th Jun 2022, 6:06 AM
Allan
Allan - avatar
0
it should be like this X ="hi" Y =input("enter number") Z =int(y) if y ==none: print("please enter input") else: print(X * Z)
16th Jun 2022, 7:35 AM
Allan
Allan - avatar