Just fix and organize the code below. Show screenshot code running! Write a menu-driven script that consolidates your code in 1 – 5. Define a function running each of them.  However, you need to use a dictionary-based Jump Table to implement the menu Sample run:        Assignment 5 Testing Script 1 Temperature Conversion and Mapping 2 Filtering Grades 3 Reducing Strings 4 Exit

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

Just fix and organize the code below. Show screenshot code running!

Write a menu-driven script that consolidates your code in 1 – 5. Define a function running each of them.

 However, you need to use a dictionary-based Jump Table to implement the menu

Sample run:

       Assignment 5 Testing Script

1 Temperature Conversion and Mapping

2 Filtering Grades

3 Reducing Strings

4 Exit

Just fix and organize the code below

# our function temp_conversion

def convert():

    for i in range(len(cel)):

        cel[i] = (9 * cel[i] / 5 + 32)

cel = []

number = int(input("How many elements you want to covert? : "))

for i in range(0, number):

    number = int(input("Enter the temperature in Celcius : "))

    cel.append(number)

print("The temperature in Celcius are", cel, "degrees")

print("The temperature in Fahrenheit are", cel, "degrees")

 

 

# our function filtering_grades

def filtering_grades():

    lst1 = []

    lst2 = []

    n = int(input("Enter number of elements : "))

 

    for i in range(0, n):

        n = int(input("Enter numbers between 1 to 100: "))

        lst1.append(n)

    print("The list of numbers are : ", lst1)

    for j in range(len(lst1)):

        if lst1[j] >= 80 and lst1[j] <= 100:

            lst2.append(lst1[j])

    print("The list of numbers in range are : ", lst2)

 

 

# our function reducing_strings

def reducing_strings():

    from functools import reduce

    words = ['Programming ', 'in ', 'Python ', 'is ', 'fun!']

    statement = ''

    result = reduce(lambda a, b: a + statement + b, words)

    print(result)

 

 

# our function myexit

def myexit():

    print("Thank you!")

    exit()

 

 

# print statements

print("-------------------------------------")

print("1.Celcius to fahrenheit conversion")

print("2.Filter even and odd number ")

print("3.Reduce the string")

print("3.Exit from program ")

print("-------------------------------------")

 

# infinite loop

while (choice):

    # asking choice

    choice = int(input(("Please enter the choice (1-4): ")))

    # if condition

    if (choice <= 0 or choice >= 5):

        print(f"Invalid choice! ")

    # else

    else:

        # if condition

        if (choice == 1):

            convert(cel)

        # elif condition

        elif (choice == 2):

 

            filtering_grades()

        # elif condition

        elif (choice == 3):

            reducing_strings()

        # elif condition

        else:

            myexit()

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY