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

Publicado el: 10 julio 2021
en el canal de: 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


En esta página del sitio puede ver el video en línea Concept: Using type - Introduction to Python: Absolute Beginner Module 1 Video 9 de Duración hora minuto segunda en buena calidad , que subió el usuario Book Simplifiers 10 julio 2021, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 21 veces y le gustó 2 a los espectadores. Disfruta viendo!