Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have this Loop code using the Main method as shown. How canit be converted into using constants and declaringcontinue_processing = True . We are

I have this Loop code using the "Main" method as shown. How canit be converted into using constants and declaring"continue_processing = True" . We are not allowed to use the "main"method for now. Thanks!!!

Provided the code and an example below:

Code to fix

image

example of loop we normally use

image

# main method def main(): # using infinite while loop to continuously prompt the user for inputs while True: choice int(input("Enter 1. Encode 2.Decode 3. Exit :")) # reading inputs from the user. if choice == 1: text = input('Enter Text:') #reading text from the user = res = encode(text) # calling encode method print('Encoded string is', res) # printing the message returned by the encode method elif choice == 2: text = input('Enter Text:') #reading text from the user res = decode(text) # calling encode method print('Decoded string is', res) # printing the message returned by the decode method elif choice == 3: exit(0) # exiting the program if the choice is 3. else: pass main() # invoking main()

Step by Step Solution

3.50 Rating (160 Votes )

There are 3 Steps involved in it

Step: 1

Python version 36 Python program to update the given code by removing the main function and using the control variable for the loop Assuming the funct... 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

Fundamentals of Cost Accounting

Authors: William Lanen, Shannon Anderson, Michael Maher

3rd Edition

9780078025525, 9780077517359, 77517350, 978-0077398194

More Books

Students also viewed these Electrical Engineering questions

Question

What is the purpose of the times-interest-earned ratio?

Answered: 1 week ago