Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

if days = = 0 : return pennies# Returns number of pennies if pennies are doubled num _ days times def double _ pennies (

if days ==0:
return pennies# Returns number of pennies if pennies are doubled num_days times
def double_pennies(num_pennies, num_days):
total_pennies =0
else:
total_pennies = double_pennies((num_pennies *2),(num_days -1))
return total_pennies
# Program computes pennies if you have 1 penny today,
# 2 pennies after one day, 4 after two days, and so on
starting_pennies = int(input())
user_days = int(input())
print('Number of pennies after', user_days, 'days: ', end="")
print(double_pennies(starting_pennies, user_days))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

Appreciate the rationale for having a human resources department.

Answered: 1 week ago

Question

What are some global employee and labor relations problems?

Answered: 1 week ago