Problem 1: Splicing strings

Write a Python program that reads from standard input a long string S and outputs four new strings:

  • S2 only contains the last two letters of S
  • S3 only contains the first two letters of S
  • S4 only contains the 2nd, 4th, and 6th letter of S
  • S5 contains the first three AND last three letters of S

You will always assume that S contains more than 6 letters.

Problem 2: Encryption

Write a Python program that reads in a string S and an integer number N and encripts S based on N

The process of encryption is

  • Step 1: reverse the first N characters of S
  • Step 2: reverse the last N characters of S

Note that it is important that the two steps are performed in that order. We will assume that N is smaller than the length of the string S.

Examples of encryption:

  • The string "This is a test" with the key N=4 is encrypted to "sihT is a tset"
  • The string "Another example" with the key N=2 is ecnrypted to "nAother exampel"

Problem 3: Computing change

Write a Python program that reads in a change amount (assumed to be between 0 and 99 cents) and computes the minimal number of coins needed to tend this change.

For example, if the change amounts is 82 cents, the output of your program should look like:

Total change: 82 cents

3 quarter(s)
0 dime(s)
1 nickel(s)
2 cent(s)
Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.