Python User Input
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)


No comments:
Post a Comment