+ 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.

17th Feb 2022, 11:01 PM
xy._.
xy._. - avatar
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
18th Feb 2022, 1:00 AM
Amd TheWise
Amd TheWise - avatar
+ 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)
18th Feb 2022, 8:15 PM
M Waseem Akhtar
M Waseem Akhtar - avatar
+ 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?
18th Feb 2022, 12:10 AM
xy._.
xy._. - avatar
18th Feb 2022, 1:12 AM
Amd TheWise
Amd TheWise - avatar
+ 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
18th Feb 2022, 6:36 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
I think I get it now. Thank you very much! Amd TheWise Rik Wittkopp
18th Feb 2022, 8:03 AM
xy._.
xy._. - avatar
0
xy._. Can you attach your code example here so we may fully understand your problem
17th Feb 2022, 11:44 PM
Rik Wittkopp
Rik Wittkopp - avatar
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")
18th Feb 2022, 12:15 AM
Amd TheWise
Amd TheWise - avatar
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)
18th Feb 2022, 12:51 AM
xy._.
xy._. - avatar
0
I am still not able to get the answer and I don't really know where did I get wrong.
18th Feb 2022, 12:51 AM
xy._.
xy._. - avatar
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
18th Feb 2022, 1:17 AM
Amd TheWise
Amd TheWise - avatar
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
18th Feb 2022, 1:20 AM
Amd TheWise
Amd TheWise - avatar
0
This is the first time that I want to learn about hyper text markup language
19th Feb 2022, 10:39 AM
Nev Jabeer
Nev Jabeer - avatar