Question
1.Complete the reverse_first_last_letters() function that takes a single string parameter word. This function: Calls the get_first_last_letters() function defined previously, passing it the parameter word to
1.Complete the reverse_first_last_letters() function that takes a single string parameter word. This function:
- Calls the get_first_last_letters() function defined previously, passing it the parameter word to obtain its first and last letters.
- Calls the get_middle_letters() function defined previously, passing it the parameter word to obtain its middle letters.
- Creates a new string consisting of the last letter from the parameter word, followed by its middle letters, and finally followed by its first letter. Use the information obtained from the previous two steps to do this.
- Prints the original word and the new word.
Note that the reverse_first_last_letters() function must call the get_first_last_letters() and get_middle_letters() functions. Do not include your code for the get_first_last_letters() and get_middle_letters() functions - this has been done for you as part of the question setup. You can assume that the reverse_first_last_letters() function will always be passed a string of length at least 3. Some examples of the function being run are shown below:
For example:
Test | Result |
---|---|
word = "computer" reverse_first_last_letters(word) | Original word: computer New word: romputec |
reverse_first_last_letters("keyboard") | Original word: keyboard New word: deyboark |
2.Complete the print_info() function that:
- Calls the get_name() function defined previously to obtain the user's name.
- Calls the get_age() function defined previously to obtain the user's age.
- Prints out a banner consisting of a single line of 15 "*" symbols, followed by the user's information (name and age on separate lines), followed by another single line of 15 "*" symbols.
Note that the print_info() function must call the get_name() and get_age() functions. Do not include your code for the get_name() and get_age() functions - this has been done for you as part of the question setup. You can assume that the user will always enter an integer value for their age. Some examples of the function being run are shown below:
For example:
Test | Input | Result |
---|---|---|
print_info() | Damir 42 | Please enter your name: Damir Please enter your age: 42 *************** NAME: Damir AGE: 42 *************** |
print_info() | Jesse 39 | Please enter your name: Jesse Please enter your age: 39 *************** NAME: Jesse AGE: 39 *************** |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started