Problem 5, Learn by Example. Write one program that correctly solves all of the problem instances. You may declare as many variables as you wantº. Remember that programs are awesome, because they can be applied to many different situations (problem instances), without changing their code. This is possible, because each instance will give your program a unique input, which can lead to different output. Example Problem and Solution Example Problem Instances (first in/out,. , last in/out) IN: A, A OUT: A, A IN: B, A OUT: A, B IN: A, B OUT: B, A A Program that solves all 3 example problem instances using the same code. Declare Single Character temp temp = input() print input() print temp Your problem which you must solve. Problem Instances " (first in/out,. , last in/out) 1. 2. 3. 4. IN: А, А, А, А, А IN: В, В, В, В, в IN: А, А, В, С, А IN: A, B, D, D, C OUT: A,A, A, A, A| OUT: B, B, В, в, в | OUT: A, А, С, В, А | OUT: С,А, D, D, B Your Program must solve all 4 of these problem instances using the same code. Write your code in a text editor, then submit it on Canvas. If you get stuck, submit different solutions for each instance or submit partial work done on this problem. Advice: Try solving instance 1, then change the code if necessary to solve instance 2, while still solving instance 1, but possibly in a new way. Repeat to include instance 3, then 4. Advice: Your program could read in the 5 data values, putting each of them into a variable, then simply instruct the program to print from those 5 variables in the appropriate order. 1You might want to declare 5 variables.. "If the user types in If the user types in Q0//C. your program should output s your program should output
Problem 5, Learn by Example. Write one program that correctly solves all of the problem instances. You may declare as many variables as you wantº. Remember that programs are awesome, because they can be applied to many different situations (problem instances), without changing their code. This is possible, because each instance will give your program a unique input, which can lead to different output. Example Problem and Solution Example Problem Instances (first in/out,. , last in/out) IN: A, A OUT: A, A IN: B, A OUT: A, B IN: A, B OUT: B, A A Program that solves all 3 example problem instances using the same code. Declare Single Character temp temp = input() print input() print temp Your problem which you must solve. Problem Instances " (first in/out,. , last in/out) 1. 2. 3. 4. IN: А, А, А, А, А IN: В, В, В, В, в IN: А, А, В, С, А IN: A, B, D, D, C OUT: A,A, A, A, A| OUT: B, B, В, в, в | OUT: A, А, С, В, А | OUT: С,А, D, D, B Your Program must solve all 4 of these problem instances using the same code. Write your code in a text editor, then submit it on Canvas. If you get stuck, submit different solutions for each instance or submit partial work done on this problem. Advice: Try solving instance 1, then change the code if necessary to solve instance 2, while still solving instance 1, but possibly in a new way. Repeat to include instance 3, then 4. Advice: Your program could read in the 5 data values, putting each of them into a variable, then simply instruct the program to print from those 5 variables in the appropriate order. 1You might want to declare 5 variables.. "If the user types in If the user types in Q0//C. your program should output s your program should output
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...
Related questions
Question
I am stuck on this problem.

Transcribed Image Text:Problem 5, Learn by Example.
Write one program that correctly solves all of the problem instances. You may declare as many
variables as you want0. Remember that programs are awesome, because they can be applied
to many different situations (problem instances), without changing their code. This is possible,
because each instance will give your program a unique input, which can lead to different output.
Example Problem and Solution
Example Problem Instances (first in/out, . , last in/out)
А, В
OUT: B, A
В, А
OUT: A, B
IN:
A, A
OUT: A, A
IN:
IN:
A Program that solves all 3 example problem instances using the same code.
Declare Single Character temp
temp = input()
print input()
print temp
Your problem which you must solve.
11
Problem Instances "(first in/out, . , last in/out)
***
1.
2.
3.
4.
А, А, А, А, А
OUT: A, A, A, A, A
А, А, В, С, А
OUT: A, A, C, B, А
В, В, В, В, В
A, B, D, D, C
OUT: C, A, D, D, B
IN:
IN:
IN:
IN:
OUT: B, B, B, В, в
Your Program must solve all 4 of these problem instances using the same code.
Write your code in a text editor, then submit it on Canvas. If you get stuck, submit different
solutions for each instance or submit partial work done on this problem.
Advice: Try solving instance 1, then change the code if necessary to solve instance 2, while still
solving instance 1, but possibly in a new way. Repeat to include instance 3, then 4.
Advice: Your program could read in the 5 data values, putting each of them into a variable, then
simply instruct the program to print from those 5 variables in the appropriate order.
10You might want to declare 5 variables..
"If the user types in
If the user types in
your program should output
Ve, your program should output
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images

Recommended textbooks for you

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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

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
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY