Advertisement
Guest User

окончание while

a guest
Jan 21st, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1.  
  2. #7-8
  3. '''sandwich_orders = ['kolbasa','maslo','ikra']
  4. finished_sandwiches =[]
  5. while sandwich_orders:
  6. preparing_sandwich = sandwich_orders.pop()
  7. print('I made your ' + preparing_sandwich.title() + ' sandwich')
  8. finished_sandwiches.append(preparing_sandwich)
  9. for finished_sandwiche in finished_sandwiches:
  10. print(finished_sandwiche.title() + ' sandwich is finished')'''
  11.  
  12. #7-9
  13. '''sandwich_orders = ['kolbasa','sosiski','maslo','sosiski','ikra','sosiski']
  14. finished_sandwiches =[]
  15. print('sosiski bol`she net ')
  16. while sandwich_orders:
  17. while 'sosiski' in sandwich_orders:
  18. sandwich_orders.remove('sosiski')
  19. preparing_sandwich = sandwich_orders.pop()
  20. print('I made your ' + preparing_sandwich.title() + ' sandwich')
  21. finished_sandwiches.append(preparing_sandwich)
  22. for finished_sandwiche in finished_sandwiches:
  23. print(finished_sandwiche.title() + ' sandwich is finished')'''
  24.  
  25. #7-10 почти то же, что и рассматривали в главе, но добавил проверку правильности ввода
  26. '''import time
  27. responses ={}
  28. polling_activate = True
  29. while polling_activate:
  30. name = input("\nWhats your name :")
  31. response = input("\nWhat are you doing today? :")
  32. responses[name]=response
  33. repeat = input("\nWould you like to let another person respond? (yes/ no) ")
  34. input_check = True
  35. #проверка правильности ввода yes/no
  36. while input_check:
  37. if repeat !='yes' and repeat!='no':
  38. print('invalid value ')
  39. repeat = input("\nWould you like to let another person respond? (yes/ no) ")
  40. else:
  41. input_check = False
  42. #----------------------------------
  43. if repeat == 'yes':
  44. polling_activate = True
  45. if repeat == 'no':
  46. polling_activate = False
  47. print('poll Result')
  48. for name, response in responses.items():
  49. print(name, " ", response)
  50. time.sleep(10)'''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement