Python User Input

Python User Input

python

 


User Input

Your programs can prompt the user for  input. All input is stored as a string.



#Prompting for a value 
name = input ("what's your name? ")
print("Hello, " + name + "!")
#Prompting for numerical input
age = input ("how old are you? ")
age = int(age)

pi = input("what's the value of pi? ")
pi = float(pi) 

Screenshot

python input

 

1 comments:

Post a Comment