Question: Write a program in python that asks the user for the position of a virtual character on the x - axis in a coordinate system
Write a program in python that asks the user for the position of a virtual character on the xaxis in a coordinate
system and then allows the user to move the virtual character to the right or left, indicated by the
characters or The user should be able to move the virtual character as often as they wish, but if the input is
neither nor l the program quits. The new position of the virtual character and instructions for the user are
written out in each iteration.
The valid range on the xaxis, which the virtual character can traverse, is from to If the virtual character is
positioned at either end of the range it will not move when the user tries to move it out of the range.
Further information about the implementation:
If the initial position of the virtual character is not bertween and the program should ask the
user again until the position is valid.
The current position is shown as while other positions on the axis are shown as
You should implement the numbers and and the characters and l as constants. In Python, a
constant is a variable whose value will not change during execution of the program. It is a good rule to
use capital letters for naming constants.
You should use functions in your implementation. It is fine that your main program contains the loop,
but the body of the loop should, in most part, be a series of function calls.
Scoring
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
