0

How can i ask for user input and add a string infront

If i ask how old are you it should bring John is: 40 years old

16th May 2020, 8:36 AM
Victor Simbeye
Victor Simbeye - avatar
4 Réponses
+ 4
a=input("how old are you") print("John is: {0} years old".format(a))
16th May 2020, 8:39 AM
Abhay
Abhay - avatar
+ 3
name = input("Enter name here: ") age = int(input("Enter age here: ")) print(f"{name} is {age} years old.") # use this shortcut to concatenate.
16th May 2020, 9:06 AM
Manish
Manish - avatar
+ 2
Vhaicko dxhemur try: s=str(input("")) print("Your string is "+s) except : print("somesing wrong")
16th May 2020, 8:42 AM
Petr
+ 1
Try using 'input()'. #code: age = input() print(age) #code end. Run this in the playground
16th May 2020, 8:42 AM
Slick
Slick - avatar