forked from ak4shp/learning-python-month-1-akash
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path06-for-loop.py
More file actions
33 lines (25 loc) · 719 Bytes
/
06-for-loop.py
File metadata and controls
33 lines (25 loc) · 719 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
'''Calculate total of a list'''
# item_rate = [11, 56, 239, 353, 8, 8, 10, 23, 15, 75]
# addition = 0
# for item in item_rate:
# addition = addition + item
# item += 1
# print(addition)
'''NESTED LOOPS'''
# 01- Print F
# numbers = [5, 2, 5, 2, 2] # operand for 'for' loop
# for num in numbers:
# print("X"*num) # Cheap way !!!!!
numbers = [5, 2, 5, 2, 2] # operand for 'for' loop
numbers1 = [5, 2, 5, 2, 5]
numbers2 = [5, 2, 5, 2, 5]
numbers3 = [2, 2, 2, 2, 5]
operands = [numbers, numbers1, numbers2, numbers3]
for nums in operands:
for num in nums:
output = ""
for show in range(num):
output += "@"
# output += "\n"
print(output)
print()