Python User Input - Supercoders | Web Development and Design | Tutorial for Java, PHP, HTML, Javascript Python User Input - Supercoders | Web Development and Design | Tutorial for Java, PHP, HTML, Javascript

Breaking

Post Top Ad

Post Top Ad

Saturday, December 1, 2018

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

 

No comments:

Post a Comment

Post Top Ad