Skip to content

Commit aad4c25

Browse files
committed
Add exercise080
1 parent fc5d4e7 commit aad4c25

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

exercise080.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
mlist = []
2+
3+
for c in range(0, 5):
4+
n = int(input('Enter a value: '))
5+
if c == 0 or n > mlist[-1]:
6+
mlist.append(n)
7+
print('Added to end of list...')
8+
else:
9+
pos = 0
10+
while pos < len(mlist):
11+
if n <= mlist[pos]:
12+
mlist.insert(pos, n)
13+
print(f'Added at position {pos} of the list')
14+
break
15+
pos += 1
16+
17+
print('-=' * 30)
18+
print(f'The values entered in order were {mlist}')

0 commit comments

Comments
 (0)