{{tag>projects cloud club computing virtualization machines VMs AWS Azure GCP}} [[python_club|About the Club]]\\ ==== Python Club Topics - Data types ==== ==== Questions ==== - What a data type? ==== Data Types ==== - string: Set of characters with letters, numbers, or symbols ( eg. numbers or numb3rs or numb3rs! ) - integer: Numbers __without__ a decimal point ( eg. 39 ) - float: Numbers __with__ a decimal ( eg. 3.9 ) - list: Set of multiple values in a single variable name ( eg. school_subjects = [ 0, "Math", 1, "Science", 2, "P.E.", 3, "Social Studies" ] ) - Also known as an "array" - tuple: Set of multiple values that cannot be changed ( eg. ( 0, "Math", 1, "Science", 2, "P.E" ) ) - sequence: An __ordered__ collection of items, capable of being accessed by index. Common sequence types in Python include lists, tuples, and strings. - set: An __unordered__ collection of unique elements. It is similar to a list or tuple, but it does not allow duplicate values. Sets are useful for tasks such as removing duplicates from a sequence, testing for membership, and performing mathematical set operations like union, intersection, and difference. - boolean: Can only have __1__ value of **True** or **False** ( eg. favorite_color = True ) ==== String ==== A string veriable is one that contains letters and numbers as characters, like words in a sentence. - Use the **type()** function to find the current type of a variable x = "Hello world!" print(type(x)) - You can also get the ***length*** of the string by using the **len()** function x = "Hello world!" print(len(x)) ==== Integer ==== - Use the **type()** function to find the current type of a variable x = 5 print(type(x)) ==== Float ==== - Use the **type()** function to find the current type of a variable x = 21.3 print(x) print(int(x)) ==== Boolean ==== - Booleans store the value of **True** or **False** - Expressions are evaluated to one of these values print(10 > 9) print(10 == 9) print(10 < 9) - All values are True except for the following conditions. - Empty string - Empty list ( We'll cover lists in the next section ) - Number 0 - Explicitly setting a value of False - Expressions that evalute to False