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
morpeh [17]
3 years ago
8

You need to write a menu driven program. The program allows a user to enter five numbers and then asks the user to select a choi

ce from a menu. The menu should offer the following four options – 1. Display the smallest number entered 2. Display the largest number entered 3. Display the sum of the five numbers entered 4. Display the average of the five numbers entered
Computers and Technology
1 answer:
Jobisdone [24]3 years ago
3 0

Answer:

In Python:

nums = []

for i in range(5):

   num = int(input("Num: "))

   nums.append(num)

print("1 - Smallest")

print("2 - Largest")

print("3 - Sum")

print("4 - Average")

menu = int(input("Select menu: "))

if menu == 1:

   print("Smallest: ",min(nums))

elif menu == 2:

   print("Largest: ",max(nums))

elif menu == 3:

   isum = 0

   for i in range(5):

       isum+=nums[i]

   print("Sum: ",isum)

elif menu == 4:

   isum = 0

   for i in range(5):

       isum+=nums[i]

   print("Average: ",isum/5)

else:

   print("Invalid Menu Selected")

Explanation:

This program uses a list to get inputs for the 5 numbers

Here, the list is initialized

nums = []

This iterates from 1 to 5

for i in range(5):

This gets input for the 5 numbers

   num = int(input("Num: "))

This appends each number to the list

   nums.append(num)

The next 4 lines represents the menu

<em>print("1 - Smallest")</em>

<em>print("2 - Largest")</em>

<em>print("3 - Sum")</em>

<em>print("4 - Average")</em>

This prompts the user for menu

menu = int(input("Select menu: "))

If menu is 1, print the smallest

<em>if menu == 1:</em>

<em>    print("Smallest: ",min(nums))</em>

If menu is 2, print the largest

<em>elif menu == 2:</em>

<em>    print("Largest: ",max(nums))</em>

If menu is 3, calculate and print the sum of all inputs

<em>elif menu == 3:</em>

<em>    isum = 0</em>

<em>    for i in range(5):</em>

<em>        isum+=nums[i]</em>

<em>    print("Sum: ",isum)</em>

If menu is 4, calculate and print the average of all inputs

<em>elif menu == 4:</em>

<em>    isum = 0</em>

<em>    for i in range(5):</em>

<em>        isum+=nums[i]</em>

<em>    print("Average: ",isum/5)</em>

If menu is not 1 to 4, then print invalid menu

<em>else:</em>

<em>    print("Invalid Menu Selected")</em>

You might be interested in
What finger is used to key letter c
kumpel [21]

Answer:

your pointer finger

sorry if this is wrong

Explanation:

8 0
3 years ago
Read 2 more answers
1. What is an advantage of the PCIe bus over the PCI bus?
m_a_m_a [10]

Answer:

Explanation:

1. PCI Express (PCIe) is a next generation I/O bus architecture. Rather than a shared bus, each PCIe slot links to a switch which prioritizes and routes data through a point-to-point dedicated connection and provides a serial full-duplex method of transmission.

2. Mini-ITX or Laptops

3.PCMCIA Personal Computer Memory Card International Association

4. PCIe x1 slot

8 0
4 years ago
PLEASE HELP BRAINLIEST TO CORRECT ANSWER!!!
dsp73

Answer:

Blank #1 Meetup

Blank#2 MySpace

Explanation:

Blank# 1 Explanation

Meetup is a platform that enables to to seek out (or create!) local meetups. You mark your preferences when you register to this site. Meetup will then inform you of local meet ups that may concern you. The meetups cover a wide range of topics varying from technical issues, professional discussion to hobbies  etc. If you do not find topic of your interest, you may set up one and Meetup can inform relevant people who have marked your topic as something that interests them. It's a perfect platform to locally gather people with same interests.

Blank #2 Explanation

MySpace is a platform for social networking. It is a social networking website which offers an engaging, user network of friends, blog, personal profiles, forums, communities, images, songs, and videos.It used to be one of the largest social networking site in the world where people communicate and interact informally.

6 0
4 years ago
Which pair of properties apply to both sound and electromagnetic waves?
Alex73 [517]
Both waves can have interference, reflection, and diffraction.

Wave interference is a phenomenon that occurs when two waves meet while traveling along the same medium. The interference of waves causes the medium to take on a shape that results from the net effect of the two individual waves upon the particles of the medium.

Wave reflection happens when a wave reaches the boundary between one medium and another medium, a portion of the wave undergoes reflection and a portion of the wave undergoes transmission across the boundary.

Wave diffraction<span> involves a change in direction of waves as they pass through an opening or around a barrier in their path.<span> </span></span>
3 0
4 years ago
Read 2 more answers
PHOTOGRAPHY
Natasha_Volkova [10]

Answer:

false

Explanation:

when you zoom in it mkes it bigger and closer not smaller and farther

hope this helps :)

8 0
3 years ago
Read 2 more answers
Other questions:
  • You can create user accounts on the linux system by using the ____ command.
    9·1 answer
  • Write a complete program whose class name is hello and that displays hello, world on the screen.
    13·2 answers
  • Can you block someone on Brainly?
    7·2 answers
  • Write a program that calculates the occupancy rate for each floor of a hotel. The program should start by asking for the number
    10·1 answer
  • What does it mean to design,<br> implement, and maintain computer<br> systems?
    15·1 answer
  • What is the meaning of N.W.O​
    9·1 answer
  • Directions: Asba student of Contact Center Service, you already have an experience using different computer programs. Try to rem
    8·2 answers
  • 1110011*110011 binary multiplication
    9·2 answers
  • How do i delete cookies on a chromebook?
    8·1 answer
  • Please help! Python programming, use the factorial operation to evaluate 4!. Answers are in picture please pick one, thank you.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!