Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Having trouble incorporating a loop to my python code i have to ask the user Do you want to calculate another population? example: while

Having trouble incorporating a loop to my python code i have to ask the user "Do you want to calculate another population?" example:
while user_value !='q':
Here are the rules:
You must use a loop to repeat the births and deaths for each generation. Do not def statements, main, break, or .lower
Your program should allow the user to repeat the calculations as many times as they wish (as above). Use a while loop for this. That part is kind of similar to the Bidding example below
import random
random.seed(5)
keep_bidding ='y'
next_bid =0
# continues to bid until the user enters 'n'.
while keep_bidding !='n':
next_bid = next_bid + random.randint(1,10)
print(f'I\'ll bid ${next_bid}!')
print('Continue bidding? (y/n)', end='')
keep_bidding = input()
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions