How to request user for inputs in your code ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to request user for inputs in your code ?

in Python

30th Oct 2017, 6:50 PM
Shyamal Bhatt
Shyamal Bhatt - avatar
3 Answers
+ 7
There is the input() phrase for that: req = input('Please specify your question: ') Mind that it returns a string, so if you want to ask for a number, you have to convert it to int, float or complex. It can be done right away, like: num = int(input('Enter a number: '))
30th Oct 2017, 6:56 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 6
You might go about it like this: https://code.sololearn.com/csSNsummyE3H/?ref=app
30th Oct 2017, 7:28 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
0
@kuba siekierzynski can you check out my code and tell me where that input statement should come
30th Oct 2017, 7:06 PM
Shyamal Bhatt
Shyamal Bhatt - avatar