Question

Save each of the following exercises as a separate file with a name like name_cases.py. (3...

Save each of the following exercises as a separate file with a name like name_cases.py.

(3 points for each exercise)

Exercise 1:

Personal Message: Store a person’s name in a variable, and print a message to that person. Your message should be simple, such as, “Hello Eric, would you like to learn some Python today?”

--------------------------------------------------------------------------------

Exercise 2:

Name Cases: Store a person’s name in a variable, and then print that person’s name in lowercase, uppercase, and titlecase.

--------------------------------------------------------------------------------

Exercise 3:

Famous Quote: Find a quote from a famous person you admire. Print the quote and the name of its author. Your output should look something like the following, including the quotation marks:

Albert Einstein once said, “A person who never made a mistake never tried anything new.”

--------------------------------------------------------------------------------

Exercise 4:

Famous Quote 2: Repeat Exercise 3, but this time store the famous person’s name in a variable called famous_person. Then compose your message and store it in a new variable called message.

Print your message.

--------------------------------------------------------------------------------

Exercise 5:

Stripping Names: Store a person’s name, and include some whitespace characters at the beginning and end of the name.

Print the name once, so the whitespace around the name is displayed.

Then print the name using each of the three stripping functions, lstrip(), rstrip(), and strip().

PreviousNext

Homework Answers

Answer #1

Solution

code

name = "Eric"
print("Hello "+name+", would you like to learn some Python today?")

Screenshot

---

Code

name = "Steve Smith"
print(name.lower())
print(name.upper())
print(name.title())

Screenshot

---

code

print('Albert Einstein once said, "A person who never made a mistake''never tried anything new."')

Screenshot

Code

famous_person = "Alber Einstein"
message = "A person who never made a mistake never tried anything new."
print(famous_person+' once said, "'+message+'"')

Screenshot

--

code

name = "\n\tAlbert Einstein \n"
print(name)
print(name.lstrip())
print(name.rstrip())
print(name.strip())

Screenshot

--

Answered all the exercises

if you have any doubt, please mention it, love to help

all the best

please upvote

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT