#start pennies_per_day = 15 nickels_per_week = 10 dimes_per_month = 5 #At the end of one year: #calculate below the number of pennies and their value. number_of_pennies = pennies_per_day*365 value_of_pennies = number_of_pennies*1 print 'Number of Pennies = ' + str(number_of_pennies) + ' Value of Pennies: ' + str(value_of_pennies) #calculate below the number of nickels and their value. number_of_nickels = nickels_per_week*52 value_of_nickels = number_of_nickels*5 print 'Number of Nickels = ' + str(number_of_nickels) + ' Value of Nickels: ' + str(value_of_nickels) #calculate below the number of dimes and their value. number_of_dimes = dimes_per_month*12 value_of_dimes = number_of_dimes*10 print 'Number of Dimes = ' + str(number_of_dimes) + 'Value of Dimes: ' + str(value_of_dimes) #calculate the total amount of money you will have at the end of one year. total_amount = value_of_pennies + value_of_nickels + value_of_dimes print 'Total Amount: ' + str(total_amount) #can you display it in dollars and cents? tot_amt_dollars = total_amount/100.00 #print '%.2f'%tot_amt_dollars print 'Total Amount in $: ' + str(tot_amt_dollars) #finish
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question