1# you can use the function type() which will returns the type of the variable
2A = "Hello world !"
3# here are some uses of it
4>>> type(A)
5<class 'str'>
6>>> type(A) is int
7False
8>>> type(A) is str
9True
1# Here are the available types in Python. Use type() to find out what
2# type your object is.
3Text Type: str
4Numeric Types: int, float, complex
5Sequence Types: list, tuple, range
6Mapping Type: dict
7Set Types: set, frozenset
8Boolean Type: bool
9Binary Types: bytes, bytearray, memoryview
10
11# Examples of types:
12Strings: "This is a string"
13 'This is also a string'
14 """
15 Triple quotes allow you to have multi-line strings and are
16 useful for automatically escaping "single quotes"
17 """
18Integers: 1
19 12345678901234567890 # Python 3 can represent huge numbers
20 # Use 0letter# to specify integers in other bases. Letters
21 # are: b for binary, o for octal, x or X for hexadecimal
22 0b10 = 2 in binary, 0o10 = 8 in octal, 0x10 = 16 in hexadecimal
23# Still working on this answer...
24Floats:
25Complex:
26Lists:
27Tuples:
28Ranges:
29Dictionaries:
30Sets:
31Booleans:
32...
1>>> type(1234)
2<class 'int'>
3>>> type(55.50)
4<class 'float'>
5>>> type(6+4j)
6<class 'complex'>
7>>> type("hello")
8<class 'str'>
9>>> type([1,2,3,4])
10<class 'list'>
11>>> type((1,2,3,4))
12<class 'tuple'>
13>>> type({1:"one", 2:"two", 3:"three"}
14<class 'dict'>
15
1# Pyhton data types
2
3# Integer
4age = 18
5
6# Float (AKA Floating point number)
7current_balance = 51.28
8
9# Boolean
10is_tall = False # can be set to either True or False
11
12# String
13message = "Have a nice day"
14
15# List
16my_list = ["apples", 5, 7.3]
17
18# Dictionary
19my_dictionary = {'amount': 75}
20
21# Tuple
22coordinates = (40, 74) # can NOT be changed later
23
24# Set
25my_set = {5, 6, 3}
1# Float
2average_tutorial_rating = 4.01
3# Integer
4age = 20
5# Boolean
6tutorials_are_good = True # True or False
7# arrays/lists
8numbers = [1, 2, 3]
1Text Type: str
2Numeric Types: int, float, complex
3Sequence Types: list, tuple, range
4Mapping Type: dict
5Set Types: set, frozenset
6Boolean Type: bool
7Binary Types: bytes, bytearray, memoryview
8