Question: Python- I'm supposed to determine if the string 'garden' contains a lowercase letter 'r' or uppercase letter 'R'. I have to use if/else or for

Python- I'm supposed to determine if the string 'garden' contains a lowercase letter 'r' or uppercase letter 'R'. I have to use if/else or for loop to solve this problem. For some reason, my code won't run. Can someone explain what I'm doing wrong as well as provide with the proper source code. Thanks

Python- I'm supposed to determine if the string 'garden' contains a lowercase

1 2 def first(s): "Determineif a string contains a lowercase or uppercase r Test data: input: 'garden output: 'r' Params: s(string) Returns: (string) lowercase r 4 Ir II 10 s 'garden' if (s 'r'): =- 12 13 14 15 16 17 18 19 return ("The string contains a lowercase r" rcase r" return ("The string contains an else ass print(first(s))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!