Description
Question 1:
In this problem you need to implement Caesar cipher. Ask the user to enter a right shift and
a string s, your program should display the encrypted string.
You program should use the shift to encrypt each capital letter as another capital letter,
each lowercase letter as another lowercase letter, and leave all other character, ie., ‘$’, ‘#’,’3’,
etc. without shifting.
For example, an execution of your answer would look like:
Enter a right shift: 23
Enter a string with at least one capital letter: Lazy Dog
Encrypted string is: Ixwv Ald
Question 2: Power table
Print out power table with 5 rows and 10 columns. Value of the power table at row i,
column j is 𝑗
𝑖
.
The columns should be spaced by a tab.
Expected output:
Question 3:
Random number guessing game: write a program to generate a random integer between 1
and 100 (inclusive) and have the user guess the number. User can guess at most 5 times.
In more detail, your program should start by generating a random number between 1 and
100.
Then you should input an integer and the program would print out a new range if your
guess is wrong. The program would also print out how many guesses you have left.
If your guess is correct, the program should announce in how many guesses you have made
it.
Example:
I thought of a number between 1 and 100! Try to guess it.
Try to guess what it is: 15
Wrong guess! Guess in range 16 to 100. You have 4 more chances.
Try to guess what it is: 34
Wrong guess! Guess in range 16 to 33. You have 3 more chances.
Try to guess what it is: 23
Congrats! You guessed my number in 3 guesses.