+ 2
Hi, I am a beginner. So I am quite confuse how to add in the input I wanted when writing the programme. Thanks!
I tried to defined my input as cool. But every time the programme would said cool is not a variable or not defined or something. So I am really confused how to solve the test.
13 Answers
+ 5
I can see where you're confused
The question is telling you to get an input __from__ the user (not typing it in the code)
So you should take inputs from both x and y, like this
x = input()
y = input()
z = x*int(y)
#Notice that input function takes everything from the user as a string, so you need to convert y to int
+ 2
When solving the practice session mention both inputs in dialog box as follows:
Hi
3
You will not be asked 2nd time for input, and you have to make two inputs in a single dialogue box (inquiry box)
+ 1
Sorry I am new to the app so I don't really know how to insert the code. But basically I am doing the course "phyton for beginners" and I am stuck at lesson 15.1, the practice question about convert the input. Do I type out the question and my answer here?
+ 1
Hope this helped, xy._.
https://code.sololearn.com/cv0n5b3Ln16f/?ref=app
+ 1
xy._. ,Amd TheWise
You can create an integer during the input phase of the code.
word = input() # creates a string
num = int(input()) # creates an integer
print(word * num) # output
Example
cool
3
Result
coolcoolcool
+ 1
I think I get it now. Thank you very much! Amd TheWise Rik Wittkopp
0
xy._.
Can you attach your code example here so we may fully understand your problem
0
From what I understand, you want the program to say "cool" at the input
Make sure it is a string (make sure to add quotation marks " ")
x = input("cool")
0
Qn :
Write a program to take x and y as input and output the string x, repeated y times.
Sample Input
hi
3
Sample Output
hihihi
My Answer:
x = input("cool")
y = int(2)
z = (x * y)
print (z)
0
I am still not able to get the answer and I don't really know where did I get wrong.
0
If you add a string between brackets in input, it should show before the user writes their actual input
However, sadly sololearn prints it along with the output
Other than str type, you'd get an error, so better leave it empty
don't forget the brackets though
0
Oh, it explains how you can add input...
Every line is 1 input (less inputs than requested will result to error)
Just type Enter after each input
0
This is the first time that I want to learn about hyper text markup language