Complete and submit the following exercises:
# Set a different value for 'str' to get the right answer. str = '' # 1. Length # The length should be 20 print("Length of str = ", len(str)) # 2. Positions # This will display the second letter: print(str) # Now, show the third letter # 3. Index # Display the position of the first match with the letter a # It should print 1 print("First position of the letter a = ", str.index("a")) # 4. Count # Count at least 5 letters a print("It has ", s.count("a")) # 5. Print in rows # Print every letter of the string # 6. For the next exercise, leave the value of `str` as it is # and use methods to change the given string to lower case, # print it, then change it to upper case and print it str = "HeLLo, hOW aRe YoU?" # Tip: search for the different Python String Methods
Example of how a solution must be submitted
Here’s an example of how the solution should be laid out:
Let’s see the first exercise:
# Set a different value for 'str' to get the right answer. str = '' # 1. Length # The length should be 20 print("Length of str = ", len(str))
Your solution will look like this:
# Set a different value for 'str' to get the right answer. str = '' # 1. Length # The length should be 20 str = "twentycharactershere" print("Length of str = ", len(str))
Time limit: 0
0 of 1 Questions completed
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Quiz complete. Results are being recorded.
0 of 1 Questions answered correctly
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Submit your code
Grading can be reviewed and adjusted.Grading can be reviewed and adjusted.
This response will be reviewed and graded after submission.