Jan-09-2018, 09:32 PM
Hi there,
I'm just learning python myself.
This is probably going to take someone all of two seconds to answer but I cannot find an easy answer to this anywhere.
In the following code, how do I print results to display two decimal places? - as in 123.45
I'm just learning python myself.
This is probably going to take someone all of two seconds to answer but I cannot find an easy answer to this anywhere.
In the following code, how do I print results to display two decimal places? - as in 123.45
#define variables with values fastmail_payment = 2.25 agile_bits = 3.67 text_expander = 3.84 amazon_aws = 16.59 dropbox = 10.46 adobe_creative_cloud = 8.57 icloud_storage = 2.49 feedly = 3.75 google_drive = 15.99 uneasy_nostalgia = 14.40 personal_blog = 8.98 monthly_payments = fastmail_payment + agile_bits + text_expander + amazon_aws + dropbox + adobe_creative_cloud + icloud_storage + feedly + google_drive yearly_payments = monthly_payments * 12 weekly_payments = monthly_payments / 4 daily_payments = monthly_payments / 30 hourly_payments = daily_payments / 24 squarespace_total = uneasy_nostalgia + personal_blog squarespace_total_year = squarespace_total * 12 print "Total for Year is: " , yearly_payments print "Total for Month is: ", monthly_payments print "Total for Week is: ", weekly_payments print "Total for Day is: ", daily_payments print "Total for Hour is: ", hourly_payments print "My Squarespace yearly total payments were: ", squarespace_total_year