+ 1

I don't understand how to use 'input' statement . Please any one tell me.

input statement in python.

24th Aug 2019, 7:48 AM
CODE LINEšŸ”‹
CODE LINEšŸ”‹ - avatar
4 Answers
+ 5
some more useful information about using input() in python You also need to know some more details about using input() function in Python. Whatever you enter, the function will return it as a string. If you enter >Tom< it will be returned as 'Tom' If you enter >237< it will be returned as '237' So both are strings. If you need your input for a calculation you have to convert it to int or float. This can be done in several ways: num = input('enter a number') num = int(num) res = num * 2 ... Or: num = input('enter a number') res = int(num) * 2 ... Or: num = int(input('enter a number')) res = num * 2 ...
24th Aug 2019, 10:46 AM
Lothar
Lothar - avatar
+ 4
#python 3 name=input("Write name:") print(name) #python 2 name= raw_input("Write your name:") print name
24th Aug 2019, 8:02 AM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar
+ 2
Thanks
24th Aug 2019, 8:13 AM
CODE LINEšŸ”‹
CODE LINEšŸ”‹ - avatar