1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
goldfiish [28.3K]
2 years ago
11

This assignment is based on Exercise 8.4 from your textbook. Each of the following Python functions is supposed to check whether

its argument has any lowercase letters.
For each function, describe what it actually does when called with a string argument. If it does not correctly check for lowercase letters, give an example argument that produces incorrect results, and describe why the result is incorrect.

# 1

def any_lowercase1(s):
for c in s:
if c.islower():
return True
else:
return False


# 2

def any_lowercase2(s):
for c in s:
if 'c'.islower():
return 'True'
else:
return 'False'


# 3

def any_lowercase3(s):
for c in s:
flag = c.islower()
return flag


# 4

def any_lowercase4(s):
flag = False
for c in s:
flag = flag or c.islower()
return flag


# 5

def any_lowercase5(s):
for c in s:
if not c.islower():
return False
return True
Computers and Technology
1 answer:
Svetradugi [14.3K]2 years ago
4 0

Explanation:

#1 is wrong because if the first character is not lowercase, it stops and returns false, ignoring all the other characters. It can be fixed by removing the else: statement and moving the return False statement outside of the loop.

This is efficient; if one lowercase character is encountered, the function 'knows enough' and can return true. Only if no lowercase is encountered it has to loop all the way to the end.

You can try this out on repl.it.

Many of the others functions have problems in them. #4 looks OK.

You might be interested in
What do you expect the future trends of an operating system in terms of, cost, size, multitasking, portability, simplicity
Anna71 [15]

Answer:

Size

Explanation:

thats it thats the answer

8 0
2 years ago
Mrs. Dunn shows her students a data range, which has been named "Goals," covering cells A14 to A25. She tells her students that
Butoxors [25]

Answer:

Hina and Riko; the dialog box is inside the Name Manager group, and it allows the user to manually type in the additional cells or select the cells after clicking the collapse button.

3 0
3 years ago
You need to set up a network that needs to span multibple buildings. For this reason, you want to use the cabling that supports
prisoha [69]

Answer:

Extended star topology

Explanation:

The Extended star topology also known as the tree topology comprises of characteristics of the linear bus topology and star topology.

It consist of multiple star connected topologies connected to a linear backbone bus topology. It has a wider communication area than the star topology and uses more cabling length. All the star networks are connected to a central connection which allows to have a full functioning network when others fails.

5 0
3 years ago
Open this link after reading about Ana's situation. Complete each sentence using the drop-downs. Ana would need a minimum of ato
Arte-miy333 [17]

bachelor degree and grow

6 0
2 years ago
Read 2 more answers
Which of the following is a proprietary OS for desktop and laptop computers?
Leni [432]

Answer:

That would be Windows.

Explanation:

If you have any questions feel free to ask in the comments - Mark

Also when you have the chance please mark me brainliest.

3 0
2 years ago
Other questions:
  • A banker would like to present a spreadsheet as part of a presentation to potential clients. The spreadsheet makes use of severa
    14·1 answer
  • WILL UPVOTE NEED ANSWERS ASAP i have till 4:30
    12·1 answer
  • What are the two basic steps in communication
    9·1 answer
  • Lisa has a section of her document that she would like to include in the index. Which option should Lisa choose?
    5·2 answers
  • Which famous individuals was born on october 31st?
    7·1 answer
  • Could someone please help?​
    10·1 answer
  • Write down the characterizations that best suits the term Java applets?
    7·1 answer
  • Taran wants to work in the technology field but is unsure of which career to pursue. He has been told he has strong people skill
    14·1 answer
  • In what way, if any, is the impact of a given risk affected by the timing of a project?
    8·1 answer
  • Acquiring new knowledge and skills at every stage of life:
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!