Concept: Using type - Introduction to Python: Absolute Beginner Module 1 Video 9

Veröffentlicht am: 10 Juli 2021
auf dem Kanal: Book Simplifiers
21
2

Concept: Using type
Using the Python type() function
type() returns the data type of Python objects

str, int, float
What does using type() reveal?
str: when type() returns str that means it has evaluated a string characters (numbers, letters, punctuation...) in quotes
int: when type() returns int that means it has evaluated an Integer (+/- whole numbers)
float: when type() returns float that means it has evaluated decimal numbers (e.g. 3.33, 0.01, 9.9999 and 3.0), ...more later in the course
Example
Read and run the code for each sample
[ ] read and run the code
type("Hello World!")
type(501)
type(8.33333)
student_name = "Colette Browning"
type(student_name)
Task 1: multi-part
Using type()
Complete the "identify data types" tasks by assigning values to the variable bucket and using type()
[ ] show the type after assigning bucket = a whole number value such as 16



[ ] show the type after assigning bucket = a word in "double quotes"



[ ] display the type of 'single quoting' (use single quotes)



[ ] display the type of "double quoting" (use double quotes)


[ ] display the type of "12" (use quotes)


[ ] display the type of 12 (no quotes)


[ ] display the type of -12 (no quotes)


[ ] display the type of 12.0 (no quotes)


[ ] display the type of 1.55


[ ] find the type of the type(3) statement (no quotes) - just for fun


Auf dieser Seite können Sie das Online-Video Concept: Using type - Introduction to Python: Absolute Beginner Module 1 Video 9 mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Book Simplifiers 10 Juli 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 21 Mal angesehen und es wurde von 2 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!