View the step-by-step solution to:

Question


def upper_lower(s: str) -> bool:

  """Return True if and only if there is at least one

alphabetic character

  in s and the alphabetic characters in s are either all uppercase or all

  lowercase.

   

  >>> upper_lower('abc')

  True

  >>> upper_lower('abcXYZ')

  False

  >>> upper_lower('XYZ')

  True

   

  """



csca08.jpg

csca08.jpg

PCRS
G
'how are you?'.isspace() - Google x
Python String examples - The Lin x
(28) Python Tutorial #17: Doc "!1 x * Homework Help - Q&A from Onl x
X
C
https://cms-pcrs.utsc.utoronto.ca/csca08w19/content/challenges/146/1#multiple_choice-299
str methods: upper or lower
0|5
Complete this function according to its docstring description.
def upper_lower(s: str) -> bool:
"""Return True if and only if there is at least one alphabetic character
1AWN
in s and the alphabetic characters in s are either all uppercase or all
< >
lowercase.
5
6
> >> upper_lower( ' abc' )
7
True
8
> > > upper_lower( ' abcXYZ' )
False
10
> >> upper_lower( ' XYZ ' )
11
True
12
13
History
Submit
* Your solution passed 0 out of 5 cases!
Expand for Detailed Error Message -
Description
Test Expression
Expected
Received
Result
all lowercase
upper_lower('abcdef')
bool:
None Type
True
None
all uppercase
upper_lower(ABCDEF')
bool:
None Type:
True
None
mix of upper and lower
upper_lower('abcXYZ')
bool:
None Type
False
None
mix of letters and non-letters
upper_lower('XYZ123')
bool:
None Type:
True
None
all numeric
upper_lower('123')
bool:
None Type
False
None
O Type here to search
U
e
R
A
10:28 PM
W O
ENG
2/10/2019
LJ

Top Answer

Please find the solution below. Let me know if you have any doubt. def upper_lower (s) : """Return True if and... View the full answer

output.JPG

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question