How to input a string and number in python and then print those two?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to input a string and number in python and then print those two??

13th Jan 2022, 2:29 PM
Phantom
Phantom - avatar
3 Answers
+ 4
Hi Phantom, as i understand you, you need two inputs. Lets say one is string, call it name, another is integer, call it number Then; name = input() # this one takes string number = int(input()) # takes integer Now you have your variables, you can use them as you wish.
15th Jan 2022, 7:42 AM
SoloilSole
SoloilSole - avatar
+ 7
input() function is used to take string inputs. You can convert it to integer using int().
13th Jan 2022, 2:40 PM
Simba
Simba - avatar
+ 1
Thank you so much for ur detailed explanation
2nd Mar 2022, 1:48 PM
Phantom
Phantom - avatar