Question: 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

example of loop we normally use

# 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
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... View full answer
Get step-by-step solutions from verified subject matter experts
