[text] 21

Viewer

  1. print('Поиграем в очко?')
  2. count = 0
  3.  
  4. while True:
  5.     choice = input('Будете брать карту? y/n\n')
  6.     if choice == 'y':
  7.         current = koloda.pop()
  8.         print('Вам попалась карта достоинством %d' %current)
  9.         count += current
  10.         if count > 21:
  11.             print('Извините, но вы проиграли')
  12.             break
  13.         elif count == 21:
  14.             print('Поздравляю, вы набрали 21!')
  15.             break
  16.         else:
  17.             print('У вас %d очков.' %count)
  18.     elif choice == 'n':
  19.         print('У вас %d очков и вы закончили игру.' %count)
  20.         break
  21.  
  22. print('До новых встреч!')

Editor

You can edit this paste and save as new:


File Description
  • 21
  • Paste Code
  • 01 Mar-2021
  • 763 Bytes
You can Share it: