Use Python string manipulation techniques, including input, slicing, indexing, case changes, and removing characters.
An alien species has sent a strange coded message to Earth.
Your job is to write a Python program that translates the message using string-manipulation techniques.
Use the input() function.
If stuck:
π https://www.w3schools.com/python/ref_func_input.asp
Your program must print:
The first character of the message
(Use indexing)
π https://www.w3schools.com/python/python_strings.asp
The last character of the message
(Negative indexing)
π https://www.w3schools.com/python/python_strings_slicing.asp
The whole message in UPPERCASE
π https://www.w3schools.com/python/ref_string_upper.asp
The whole message in lowercase
π https://www.w3schools.com/python/ref_string_lower.asp
The number of characters in the message
(Use len())
π https://www.w3schools.com/python/ref_func_len.asp
Create a decoded message using the rules below:
Take every 3rd character from the original message
π slicing help: message[::3]
https://www.w3schools.com/python/python_strings_slicing.asp
Remove all spaces from the extracted result
π .replace(" ", "")
https://www.w3schools.com/python/ref_string_replace.asp
Convert it to lowercase
π https://www.w3schools.com/python/ref_string_lower.asp
Store your result in a variable called decoded.
Example:
Original message: WE COME IN PEACE
Decoded message: wcipe
Try one or more:
Check whether the message contains the substring "EARTH" (in any case).
π https://www.w3schools.com/python/ref_string_find.asp
Reverse the entire message using slicing ([::-1]).
π https://www.w3schools.com/python/python_strings_slicing.asp
Count how many vowels (a e i o u) appear in the message.
π loop help: https://www.w3schools.com/python/python_for_loops.asp