filmov
tv
Python Programming: Lesson 20 - None data type and Tuples

Показать описание
PLEASE SUBSCRIBE!!!
# execute code to read the text in the text file
The None data type refers to the absence of data. It is like null in other programming languages. For example, if we try printing the result of a function that simply prints something without returning anything, then None would be returned as output.
Tuples are another type of data structure in Java. Like lists, they can hold multiple elements of varied data types, have index positions, and have a length. We can also determine the frequency of an element in a tuple, concatenate 2 tuples together, and determine the index position of the first occurrence of an element within a tuple. Unlike lists, we cannot add, remove, or modify a tuple in any way after it has been initially created.
We can create tuples with or without parenthesis (but when using tuples as inputs to other functions, usually parenthesis will be required:
myTuple1 = 5 , 2 , 3
myTuple2 = "a" , 5.2 , 9
myTuple3 = myTuple1 + myTuple2
print( myTuple3[ 0 ] + len( myTuple[ 3 ] ) ) prints 11, because 5 + 6 = 11
myTuple3[1] = 15 is an illegal operation and would produce a runtime error in Python
0:35 Review of File I/O
7:15 NEW: the None data type
10:01 NEW: Tuples
Thanks for watching, and PLEASE SUBSCRIBE!!!
# execute code to read the text in the text file
The None data type refers to the absence of data. It is like null in other programming languages. For example, if we try printing the result of a function that simply prints something without returning anything, then None would be returned as output.
Tuples are another type of data structure in Java. Like lists, they can hold multiple elements of varied data types, have index positions, and have a length. We can also determine the frequency of an element in a tuple, concatenate 2 tuples together, and determine the index position of the first occurrence of an element within a tuple. Unlike lists, we cannot add, remove, or modify a tuple in any way after it has been initially created.
We can create tuples with or without parenthesis (but when using tuples as inputs to other functions, usually parenthesis will be required:
myTuple1 = 5 , 2 , 3
myTuple2 = "a" , 5.2 , 9
myTuple3 = myTuple1 + myTuple2
print( myTuple3[ 0 ] + len( myTuple[ 3 ] ) ) prints 11, because 5 + 6 = 11
myTuple3[1] = 15 is an illegal operation and would produce a runtime error in Python
0:35 Review of File I/O
7:15 NEW: the None data type
10:01 NEW: Tuples
Thanks for watching, and PLEASE SUBSCRIBE!!!