-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy path011_complex_examples.py
More file actions
55 lines (50 loc) · 943 Bytes
/
011_complex_examples.py
File metadata and controls
55 lines (50 loc) · 943 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
# Video https://youtu.be/PY_sfXfCLOU
# Priklad 1
# Napiste kod ktory na zaklade 2 premennych vyska a sirka vypise mriezku vyplnenu hviezdickami
# rows = 3
# columns = 2
# **
# **
# **
rows = 5
columns = 10
for row in range(0, rows):
for column in range(0, columns):
print("*", end="")
print("")
# Priklad 2
# rows = 3
# *
# **
# ***
# **
# *
rows=3
for row in range(1, rows + 1):
for columns in range(0, row):
print("*", end="")
print("")
for row in range(rows - 1, 0, -1):
for columns in range(0, row):
print("*", end="")
print("")
# Priklad 3
# rows=3
# 1
# 1 2
# 1 2 3
# 1 2
# 1
rows = 5
for row in range(1, rows + 1):
temp = ""
for column in range(1, row + 1):
temp += str(column)
temp += " "
print(temp)
for row in range(rows - 1, 0, -1):
temp = ""
for column in range(1, row + 1):
temp += str(column)
temp += " "
print(temp)