Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

12:47 pm Wed 13 Mar @ 189% a mytut2.uqcloud.net Due: 20:30 15th Mar v Week 2: Introductory Programming- (3/3) completed while-average 2019 Save Attempt Reset

image text in transcribedimage text in transcribedimage text in transcribed

12:47 pm Wed 13 Mar @ 189% a mytut2.uqcloud.net Due: 20:30 15th Mar v Week 2: Introductory Programming- (3/3) completed while-average 2019 Save Attempt Reset Attempt Run Code intro input inputnumber 2ase enter the number of numbers:While Statements While statements provide a mechanism that allows repeated computations to be performed. The while statement has the form v Week 3: Control Structures - (1/5) completed while condition: body_code O if abs & if_vowel O if sign Owhile_average Owhile_break_average where condition is a boolean valued expressions and body_code IS a sequences of statements. body_code is repeatedly evaluated until condition becomes false and in which case computation continues with the statement following the while statement. v Week 4: Functions - (0/3) completed When writing a while loop there are a few things that you need to consider Ofunl Ofun_square Owhile function Test output will appear here once you run the code Week 5: Data Structures (Lists. Strings & Tuples) - (0/8) completed 12:47 pm Wed 13 Mar @ 189% mytut2.uqcloud.net Due: 20:30 15th Mar v Week 2: Introductory Programming- (3/3) completed O while_average 2019 Save Attempt Reset Attempt Run Code intro input inputnumber Typically, you will need to initialize one or more variables before the while statement. ase enter the number of numbers:")) The condition (test) of the while v Week 3: Control Structures - (1/5) completed statement will usually become false eventually (otherwise the loop won't terminate) . The body code typically changes O if abs & if_vowel O if sign Owhile_average Owhile_break_average one or more variables in such a Way that the condition will become For example, the following code when executed, will output a countdown. The variable count is first initialized, the condition tests if count has reached O, and in the body of the loop count is decremented (and will eventually become O) count- 5 v Week 4: Functions - (0/3) completed Ofunl Ofun_square Owhile function Test output will appear here once you run the code v Week 5: Data Structures (Lists, Strings & Tuples) - (0/8) completed 12:47 pm Wed 13 Mar @ 189% mytut2.uqcloud.net Due: 20:30 15th Mar v Week 2: Introductory Programming- (3/3) completed O while_average 2019 Save Attempt Reset Attempt Run Code intro input inputnumber eventually become O) ase enter the number of numbers:")) count 5 while count 0: print (count) countcount - 1 print("Thunderbirds are Go") v Week 3: Control Structures - (1/5) completed O if abs & if_vowel O if sign Owhile_average Owhile_break_average Write a program that first prompts the user to enter the number of numbers to be entered and then uses a while loop to repeatedly prompt the user for those numbers and adds the numbers to a running total. When the correct number of numbers have been entered, the program should print the average You can assume the number of numbers entered is an integer greater than zero and that each subsequent number is a float v Week 4: Functions - (0/3) completed Ofunl Ofun_square Owhile function Test output will appear here once you run the code Week 5: Data Structures (Lists. Strings & Tuples) - (0/8) completed

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

Data Infrastructure For Medical Research In Databases

Authors: Thomas Heinis ,Anastasia Ailamaki

1st Edition

1680833480, 978-1680833485

More Books

Students also viewed these Databases questions

Question

What is an RFP?

Answered: 1 week ago

Question

Prove Theorem11.5.

Answered: 1 week ago

Question

What is the wedge and dash notation of N2O?

Answered: 1 week ago