1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Arte-miy333 [17]
3 years ago
3

Add an if branch to complete double_pennies()'s base case. Sample output with inputs: 1 10 Number of pennies after 10 days: 1024

Note: If the submitted code has an infinite loop, the system will stop running the code after a few seconds, and report "Program end never reached." The system doesn't print the test case that caused the reported message.

Computers and Technology
1 answer:
Lerok [7]3 years ago
5 0

Explanation:

A recursive function double_pennies is created which takes two inputs, the amount of pennies and the number of days.

The base case is

if days == 0:

       return pennies

otherwise function keeps on calling itself until

total = double_pennies((pennies * 2), (days - 1));

Python Code:

def double_pennies(pennies, days):

   total = 0

   if days == 0:

       return pennies

   else:

       total = double_pennies((pennies * 2), (days - 1));

   return total

Driver Code:

pennies = 1

days = 10

print("no. of pennies after", days, "days: ", end="")

print(double_pennies(pennies, days))

Output:

no. of pennies after 10 days: 1024

no. of pennies after 20 days: 1048576

You might be interested in
A _____ miniature battery operated transmitter that can be propelled through a non-metallic pipe or purpose of locating
Anna11 [10]
I think it is the model ET-2. Not quite sure.
7 0
3 years ago
Attackers craft malicious probe packets and scan for services such as HTTP over SSL (HTTPS), SMTP over SSL (SMPTS) and IMAP over
pentagon [3]

Answer:(d)Scan shows that no scanned port is live on the network

Explanation:

Honeypot shows any attempt of unauthorized access to information in the system. Scan showing not scanned port is live on the network shows the presence of honeypot so that hackers could be trapped to be believed that there are no scanned port.

4 0
3 years ago
A written guarantee to fix or replace an item is called a _____.
VladimirAG [237]
A warranty is a statement given by the manufacturer or other company
3 0
4 years ago
Read 2 more answers
I don't have a split screen in my Samsung Galaxy A02 why???​
weqwewe [10]

Answer:

YOU CAN open

Turn on Multi Window

1. Select the Recent apps key. 2. Select the desired app icon, then select Open in split screen view.

Explanation:

PLEASE MARK ME BRAINLIEST IF MY ANSWER IS CORRECT

6 0
2 years ago
The next generation ip version and successor to ipv4 is called what? ipv5 ipv6 iana ssl
Olenka [21]
I study IT,it was Ipv 6 in our textbook
4 0
4 years ago
Other questions:
  • Explain the steps you take when conducting research online to ensure it the source is providing reliable information.
    6·1 answer
  • Using an LCD projector to show an online video to a group of people is an example of:
    14·1 answer
  • Write the program to solve quadratic equations, but if the discriminant is negative, output
    9·1 answer
  • Rows within a spreadsheet are identified by:
    8·1 answer
  • A student has created a Book class. The class contains variables to represent the following.An int variable called pages to repr
    11·1 answer
  • List four useful spreadsheet functions and explain what they do.
    11·1 answer
  • What term identifies the physical interface between a computer and its peripherals?
    5·1 answer
  • Create an application named StudentsStanding.java that allows you to enter student data that consists of an ID number, first nam
    12·1 answer
  • Briefly explain what an array is. As part of your answer make use of a labelled example to show the declaration and components o
    5·1 answer
  • Is social media bringing people together or cause in sepretation?​
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!