Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. # P1.py
  2. #
  3. # prompts user for two interger values, print the result of the first number
  4. # divided by the second number, with exactly two decimal places.
  5. #
  6. # date: 08/28/2016
  7. # author: Chiayo Lin
  8. # license: GPL 3.0
  9.  
  10. # this is a simple and scalable way to get user's input into a list with a
  11. # different prompt each time so i think it would be a good idea to use map()
  12. # with an inline function.
  13. integers = list(map(lambda prompt: \
  14. int(input("Enter the " + prompt + " integer: ")), ("first ", "second")))
  15.  
  16. print(format((integers[0] / integers[1]), '.2f'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement