Question: Python programming- Determine if the word garden contains a lowercase or uppercase r. I created a for loop to solve this problem, and it runs.
Python programming- Determine if the word garden contains a lowercase or uppercase r. I created a for loop to solve this problem, and it runs. I was told that I made it complicated. How do you do this in a simpler way using a for loop with for c in s as part of the for loop. This is a beginner course, and we just know about return statements and loops and definining functions. Please keep that mind when answering the question.

1 2 f first (s): "Determine if a string contains a lowercase or uppercase r Test data: input: 'garden' output: 'r Params: s(string) Returns: (string) lowercase r 4 r Ir It c= 'r' for cin s: 10 if c == 'r': 12 13 14 15 16 17 18 return ("The stri contains a lowercase r") else pass s 'garden' rint (first (s))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
