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 Réponses
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