Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pay = float(raw_input('How much do you make per hour?\n'))
- # The result of the user's input is converted into a float and stored in the variable pay
- hours = float(raw_input('Now how many hours did you work this week?\n'))
- # The result of the user's input is converted into a float and stored in the variable hours
- if hours > 40:
- print 'Your total pay this week (including overtime) is $', format((hours-40)*pay*1.5+40*pay, '.2f'), '.', sep=''
- # format(value, '.2f') means the value inside it will have two decimals, whereas '.3f' would have three, and so on
- # sep='' means there's no space between the printed elements, else $ and . would be buffered by a space
- else:
- print 'Your total pay this week is $', format(pay*hours, '.2f'), '.', sep=''
- # 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