Guest User

Untitled

a guest
Dec 12th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. '''Multiply Maximazer
  2.  
  3. Get 4 numbers as an input. Split into two double digits number that generates the maximum number
  4. when they are multiplied by each other
  5. '''
  6.  
  7. def Multiply_Max(numbers):
  8. '''Sort the list reverse. Use indexing and make two double digits numbers a,b.
  9. The biggest number and the smallest number should be accompanied wheareas, middle 2 numbers should also be accompanied
  10. In order to calculate a*b, both a, b should be integers. change all the indexed to int.
  11. '''
  12.  
  13. numbers.sort(reverse=True)
  14.  
  15. a = int(numbers[0])*10 + int(numbers[3])
  16. b = int(numbers[1])*10 + int(numbers[2])
  17.  
  18. return (a*b)
  19.  
  20. #num is a list of input
  21. num = list(input("Please enter 4 digits of number:"))
  22. print("Maximum number is:", Multiply_Max(num))
Add Comment
Please, Sign In to add comment