Computers and Technology
20.01.2020 09:55
165
206
10
Solved by an expert

3.6 code practice (edhesive)

3.6 code practice (edhesive)
3.6 code practice (edhesive)
Show Answers
jujusmith2022
jujusmith2022
4,7(16 marks)

The program illustrates the use of conditional statements and iterations

The complete program in Python is as follows, where comments are used to explain each line.

#This gets the first input from the user

userNum = int(input("Enter a number: "))

#This prints the first input as the largest

print("Largest:",userNum)

#This assigns to largest, the value of userNum

largest = userNum

#The following iteration is repeated 5 times

for i in range(5):

   #This gets another input from the user

   userNum = int(input("Enter a number: "))

   #This checks if current input is greater than the current largest input

   if userNum > largest:

       #If yes, this assigns to largest, the value of userNum

       largest = userNum

   #This prints the current largest input

   print("Largest:",largest)

In each iteration, the program prints the current largest input

See attachment for the sample run

Read more about iteration and conditions at:

link

mdakane3772
mdakane3772
4,4(19 marks)

largest = int(input("Enter a number: "))

print("Largest: {}".format(largest))

i = 0

while i < 5:

   num = int(input("Enter a number: "))

   if num > largest:

       largest = num

   print("Largest: {}".format(largest))

   i += 1

I hope this helps!


3.6 code practice (edhesive)
arieannaensley0616
arieannaensley0616
4,9(7 marks)

Database. This is the most common program used on a regular basis at businesses.

Explanation:

Popular Questions about the subject: Computers and Technology

The article begins with the author mentioning the need to find something from...
Computers and Technology
24.01.2022 10:14
If your role model is from the same neighborhood as you or has the same ethnic...
Computers and Technology
17.05.2022 12:31
What if you put a flashdrive in a iphone block and plug it in an outlet...
Computers and Technology
24.01.2020 01:43
After a cs comes to elicit the cr, the cs now can be paired with a new neutral...
Computers and Technology
01.08.2022 05:30
4. add comments to the following mips code anddescribe in a sentence or two whatit...
Computers and Technology
13.04.2021 09:56
Use the data type for columns that contain letters and special characters and...
Computers and Technology
26.09.2022 01:36
Write and execute a select statement that will return the customer’s name, city,...
Computers and Technology
25.12.2021 07:59
Database uses the approach of programming while both the data and the processing...
Computers and Technology
18.07.2021 00:20
Controlled makes a relational database work....
Computers and Technology
31.01.2022 00:13
The character data type is used for a field that can store a variable amount of...
Computers and Technology
31.12.2022 06:32

New questions by subject

Complete the statements about circle J. MP is a v and measures degrees. MLN is...
Mathematics
22.12.2020 00:03
Plzzzzzzzzzzzzzzz help me on dis...
Mathematics
10.05.2021 20:37
Find the slope of the line that passes through the points(1,9) and (4,7) m=...
Mathematics
08.08.2021 10:15
20. Monty has 60 coins. Some are quarters and some are dime The number of dimes...
Mathematics
09.10.2022 02:58
A video game system costs $350. The sales tax rate is 796, what is the final cost...
Mathematics
23.08.2022 18:02
Does anyone work in ICEV.com...
Health
28.03.2020 19:07
What characteristic did early hominins share with modern humans​...
Chemistry
01.11.2020 15:35
Solve 2^4 20. Round to the nearest ten-thousandth....
Mathematics
25.12.2021 16:44
Who was the first president elected in the 20th century...
History
06.06.2020 14:53
#
#
#
#
# #

We expand our knowledge with many expert answers