Guest User

Digit Game

a guest
Jun 19th, 2024
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. def num_operations(a, b):
  2.     max_num = 0
  3.     if a + b > a * b:
  4.         max_num = a + b
  5.     else:
  6.         max_num = a * b
  7.    
  8.     return max_num
  9.  
  10.  
  11. number = [int(n) for n in input()]
  12. biggest_number = 0
  13.  
  14. for num in number:
  15.     temp = number.copy()
  16.     temp.remove(num)
  17.  
  18.     temp_max = num_operations(temp[0], temp[1])
  19.  
  20.     if biggest_number < num_operations(num, temp_max):
  21.         biggest_number = num_operations(num, temp_max)
  22.  
  23.  
  24.  
  25. print(biggest_number)
  26.  
Tags: Digit game
Advertisement
Add Comment
Please, Sign In to add comment