Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. pay = float(raw_input('How much do you make per hour?\n'))
  2. # The result of the user's input is converted into a float and stored in the variable pay
  3. hours = float(raw_input('Now how many hours did you work this week?\n'))
  4. # The result of the user's input is converted into a float and stored in the variable hours
  5. if hours > 40:
  6. print 'Your total pay this week (including overtime) is $', format((hours-40)*pay*1.5+40*pay, '.2f'), '.', sep=''
  7. # format(value, '.2f') means the value inside it will have two decimals, whereas '.3f' would have three, and so on
  8. # sep='' means there's no space between the printed elements, else $ and . would be buffered by a space
  9. else:
  10. print 'Your total pay this week is $', format(pay*hours, '.2f'), '.', sep=''
  11. # Again, the value result is formatted with two decimal places, and sep='' cuts out the space between printed elements
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement