user input - Introduction to Python: Absolute Beginner Module 1 Video 15

Publié le: 24 juillet 2021
sur la chaîne: Book Simplifiers
39
3

Concept: user input
input()
get information from users with input()
the input() function prompts the user to supply data returning that data as a string
Example
review and run code - enter a small integer in the text box
print("enter a small int: ")
small_int = input()
print("small int: ")
print(small_int)
Task 1
storing input in a variable
[ ] create code to store input in student_name variable
an input box should when run
[ ] type a name in the input box and press Enter
[ ] determine the type() of student_name
[ ] get input for the variable student_name

[ ] determine the type of student_name



Task 1 continued...
note: input() returns a string (type = str) regardless of entry

if a string is entered input() returns a string
if a number is entered input() returns a string

[ ] determine the type() of input below by entering

a name
an integer (whole number no decimal)
a float a number with a decimal point
[ ] run cell several times entering a name a int number and a float number after adding code below
print("enter a name or number")
test_input = input()
[ ] insert code below to check the type of test_input


Sur cette page du site, vous pouvez voir la vidéo en ligne user input - Introduction to Python: Absolute Beginner Module 1 Video 15 durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Book Simplifiers 24 juillet 2021, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 39 fois et il a aimé 3 téléspectateurs. Bon visionnage!