Drop hier links of afbeeldingen om ze aan de editor toe te voegen.

Another modify task, and this one works with ASCII codes.

A game hides its messages by shifting every character exactly 3 places forward in ASCII, so that A becomes D. To decode a character, the program has to turn it into its ASCII code, add 3, and turn the result back into a character.

The programmer has started the code, but left gaps where the conversions between strings and ASCII codes should go. Every gap is marked with question marks:

print("Enter character:")
char_input = input()

ascii_val = ???char_input
new_val = ascii_val ??????
new_char = ???new_val

print("Shifted character is: " + ????)

The editor starts you off with this code. It does not run as it stands: Python stops at the first line of question marks.

Your task

Modify the program so that it:

Keep the question exactly as it is. The user always types exactly one character.

The output

The question first, worded exactly like this:

Enter character:

Then one line, where CHARACTER is the character three places further along in ASCII:

Shifted character is: CHARACTER

Example

Input:

A

Output:

Enter character:
Shifted character is: D

Input:

x

Output:

Enter character:
Shifted character is: {

The shift follows the ASCII codes and does not start again at a after z, so a letter near the end of the alphabet turns into whatever comes three codes further on. Here that is {, the character with code 123. Digits and punctuation shift too: 7 becomes :.

Help! My code doesn't work!

Make sure that you check for the following things:

  • Every set of question marks has been replaced. Python cannot run a line that still has one.
  • ord turns a character into its code, and chr turns a code back into a character. Check you have not swapped them.
  • ord and chr put their brackets around what they are given, as in ord(char_input).
  • The 3 is added to the code, the number, not to the character.
  • The last print outputs the new character, not the new code.