1-Choose your types of list as follows: Plants, Animals, Cities,
Countries, Football Teams, Classmates, Customers, Chemical elements, etc.
2-Draw flow chart and write python program in according to
following instruction:
*Add elements to your list.
*Remove element from tour list.
*Edit element on your list.
*Sort your elements.
*Print one element from your list.
*Print all of the elements from
your list.
classmates = ['Сабардак Алексей', 'Тоцкая Кристина', 'Иванкина Катя']
print('1 - Add elements to your list.\n'
'2- Remove element from tour list.\n'
'3 - Edit element on your list.\n'
'4 - Sort your elements.\n'
'5 - Print one element from your list.\n'
'6 - Print all of the elements from your list.')
choice = int(input('Choose an option: '))
if choice == 1:
add = input('Enter new classmates: ')
classmates.append(add)
print(classmates)
elif choice == 2:
delt = input('Select the index of the student you want to delete: ')
classmates.remove(delt)
print(classmates)
elif choice == 3:
addi = int(input('Enter the index you want to replace: '))
addn = input('Enter the name you want to replace: ')
classmates[addi] = addn
print(classmates)
elif choice == 4:
classmates.sort()
print(classmates)
elif choice == 5:
prnt = int(input('Enter the index of the student you want to display: '))
print(classmates[prnt])
elif choice == 6:
print(classmates)
else:
print('Wrong number!')
Comments
Leave a comment