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
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 + ", "))
+ 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.
+ 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.
+ 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") ššš
+ 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ā.
0
The input(3)
gets user input and you already know your input to be 3
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)