Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.23 KB | None | 0 0
  1. from colorama import init
  2. from colorama import Fore, Back, Style
  3.  
  4.  
  5. init()
  6. print(Back.CYAN)
  7. print(Style.BRIGHT)
  8. print(Fore.MAGENTA)
  9.  
  10. what = input ('Выберите действие. (+,-,*, / ,**,***,округление,pi): ')
  11.  
  12. a = float(input('Введите первое число:'))
  13.  
  14. if what in ['+','-','*', '/' ,'округление','pi']:
  15.     b = float(input('Введите второе число:') )
  16. else:
  17.     b = 0
  18.  
  19. if what =='+':
  20.     c = a + b
  21.     print(Back.GREEN )
  22.     print('Результат : ' + str(c))
  23. elif what =='-':
  24.     c = a - b
  25.     print(Back.RED )
  26.     print('Результат : ' + str(c))
  27. elif what =='*':
  28.     c = a * b
  29.     print(Back.BLUE)
  30.     print('Результат : ' + str(c))
  31. elif what =='**':
  32.     c = a * a        
  33.     print(Back.WHITE)
  34.     print('Результат : ' + str(c))
  35. elif what =='/':
  36.     c = a / b        
  37.     print(Fore. BLACK )
  38.     print(Back.MAGENTA)
  39.     print('Результат : ' + str(c))
  40. elif what =='***':
  41.     c = a * a * a      
  42.     print(Back.WHITE)
  43.     print('Результат : ' + str(c))
  44. elif what =='округление':
  45.     c = round(a)    
  46.     print(Back.WHITE)
  47.     print('Результат : ' + str(c))
  48.     input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement