Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help. Try to solve it but output doesn't match. please use Python... 1 ) Let's discover the largest number in a long list of

Need help. Try to solve it but output doesn't match. please use Python...
1) Let's discover the largest number in a long list of numbers. Write a script which uses a for statement to compare values in the list function to match the output under Desired Output.
# Create the maximum variable
maximum =0
# Create for statement
for maximum in [60,91,64,70,51,7,49,65,96,39,13,61,78,76,66,16,17,73,34,89]:
if maximum is 0> maximum
# Display results
print("The largest number is", maximum)
Desired Output:
The largest number is 96
2) Write an input validation loop which prevents the user from entering a number larger than 100 or less than 0. Then, enter the appropriate numbers when prompted so you match the output under Desired Output.
# Collect input and assign to /jelly_beans/
jelly_beans = int(input("How many jelly beans do you want? "))
# Write input validation loop
# /jelly_beans/ must be greater than 0
# and less than 100
# Display final result
print("You want", jelly_beans, "jelly beans")
Desired Output:
How many jelly beans do you want? -5
Please enter a number between 0 and 100
How many jelly beans do you want? 200
Please enter a number between 0 and 100
How many jelly beans do you want? 75
You want 75 jelly beans
3) Use a for loop and the range function to match the output under Desired Output.
Desired Output:
Hi
Hi
Hi
Hi
Hi

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_2

Step: 3

blur-text-image_3

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

Progress Monitoring Data Tracking Organizer

Authors: Teacher'S Aid Publications

1st Edition

B0B7QCNRJ1

More Books

Students also viewed these Databases questions

Question

Discuss the benefits and limitations of working in teams.

Answered: 1 week ago