Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started