Question

Q1.1

5 Points

Using cascaded string methods, convert and print YOUR first and last names in all caps, with no

spaces, starting from a string that uses the usual capitalization and spacing.

For example, starting with

"Michael Branicky"

my ONE LINE OF CODE would output

MICHAELBRANICKY

Hint: see LEC 13 and/or the palindromes notebook(s) for string reversal.

Turn-in: Cut-and-paste your (1) line of code and (2) output in the box below./nQ1.2

5 Points

Write a user-defined function, called reverser, that takes a string, s, as input and returns a string

that is that one in reverse.

For example,

reverser ("BRANICKY")

should return "YKCINARB"

Then, write a single line that calls your function on YOUR last name.

Turn-in: Cut-and-paste your (1) function, (2) test line, and (3) output in the box below./nQ1.3

5 Points

Write a couple lines of Python that produce a sorted string of the letters in your first and last

names (starting with everything capitalized and no spaces).

For example, starting from

name = "MICHAELBRANICKY"

my lines would produce

AABCCEHIIKLMNRY

Hints: See LEC 15 for sorting and join

Turn-in: Cut-and-paste your (1) lines of code and (2) output in the box below./n5 Points

Write a couple lines of Python that produce the set of characters that are in BOTH your first and

last names (starting with everything capitalized).

For example, starting from

first = "MICHAEL"

last = "BRANICKY"

my little program would produce the set:

('I', 'C', 'A')

Hints: see LEC 15 for sets and set intersection.

Turn-in: Cut-and-paste your (1) lines of code and (2) output in the box below.

Question image 1Question image 2Question image 3Question image 4