-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01.python-tutorial.py
More file actions
71 lines (44 loc) · 1019 Bytes
/
Copy path01.python-tutorial.py
File metadata and controls
71 lines (44 loc) · 1019 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
x = 5
y = "computer"
z = 0.2
print(x, y, z)
x, y, z = 5, "computer", 0.2
print(x, y, z)
some_list = [5, "computer", 0.2]
x, y, z = some_list
print(x, y, z)
some_tuple = (5, "computer", 0.2)
x, y, z = some_tuple
print(x, y, z)
some_set = {5, "computer", 0.2}
print(some_set)
some_dict = {'key1': 5, 'key2': "computer", 'key3': 0.2}
print(some_dict)
print(some_dict.keys())
print(some_dict.values())
print(some_dict['key1'])
x, y = 5, 0.2
print(x, "+", y, "=", x + y)
print(f"{x} + {y} = {x+y}") # formatted strings
sentence = "This course is THE BEST!"
print(sentence)
print(sentence.upper())
print(sentence.lower())
print(sentence.split(' '))
print('-'.join(sentence.split(' ')))
x, y = 5, 10
if x > y:
print("x > y")
elif x == y:
print("x == y")
else:
print("x < y")
for i in range(10):
print(i)
objects = ["pc", "phone", "wallet"]
for obj in objects:
print(obj)
for i in range(len(objects)):
print(i, objects[i])
for i, obj in enumerate(objects):
print(i, obj)