Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions