هنا انا سويتة كامل ولكن تبقت لي خطوة واحدة ما عرفت اسويها :
اريد ان البرنامج يتوقف من بعد ما ادخل رقم 4 يعني لما ادخل رقم 4 ويطلعلي جود باي
خلاص ما يظهر شي بعدة يتوقف التكرار
while True:
print('list1: 1 , 3 , 2')
print('List of method are here please choose one')
print('1. Add to the list')
print('2. Sort the list')
print('3. Reverse the list')
print('4. 999 to exit')
selection1 ='1. Add to the list'
selection2 ='2. Sort the list'
selection3 ='3. Reverse the list'
selection4 ='4. 999 to exit'
list1=["1" , "3" , "2"]
mySelection = int(input("Your selection is:"))
if mySelection >= 5:
break
if mySelection == 1:
print('list1: 1 , 3 , 2')
x = input('\nadd to list:')
list1.append(x)
print(list1)
elif mySelection == 2:
print('list1: 1 , 3 , 2')
list1.sort() #sort the list
print('new list' , list1)
elif mySelection == 3:
print('list1: 1 , 3 , 2')
list1.reverse() #reverse the list
print(list1)
elif mySelection == 4:
print("**Good Buy**")