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 Antworten
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)