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
Nesta página do site você pode assistir ao vídeo on-line Concept: Using type - Introduction to Python: Absolute Beginner Module 1 Video 9 duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Book Simplifiers 10 Julho 2021, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 21 vezes e gostou 2 espectadores. Boa visualização!