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]
3 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]3 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
Use computer magazines and/or the internet to investigate one of these DBMSs: DB2, SQL Server, MySQL, Oracle, or Sybase. Prepare
tigry1 [53]

Answer:

The definition for the problem is listed in the section below on the explanations.

Explanation:

<u>For SQL Server</u>

  • Data Recovery: Data recovery is done well on SQL Server. It is achieved by the restoration method. Behind this, a sysadmin must reconstruct a collection of SQL backups throughout a restore series that is technically right as well as relevant.
  • Data Security: There are several approvals as well as limits for accessing main data objects or databases. These data are accessed only by the approved clients.
  • Concurrency Control: This is essentially synchronization of the evidence or information accessed by multiple users as well as from separate locations.

Concurrency or Competitiveness control becomes accomplished with SQL Server Portable, using locking to further improve security. The locking regulates how multiple individuals can simultaneously navigate & alter shared storage, without interfering with one another.

8 0
3 years ago
You can use RWA to demonstrate how to do something special on the web, such as displaying articles found on websites that suppor
Vikki [24]

Answer:

C. real time web access

Explanation:

Real time web access can be used to demonstrate how to do something special on the web, such as displaying articles found on websites that support your topic.

It can also be used to it provide a sense of immediacy to your speech.

It involves employing a live internet feed as a visual media or information resource during a speech, that is using a real time video online to deliver your speech.

5 0
3 years ago
When an organizatin needs a program to do a very specific job, it mayhire someone to write _____ software.​
Harman [31]
Code sofware your welcome
8 0
3 years ago
Select the three statements that best describe benefits to testing a system.
tester [92]

Answer:

Following are the three statements which best describe  benefits to testing a system.

Explanation:

First

Allows you to correct inaccurate requirements

Second

Allows you to validate characteristics

Third

Allows you to capture the required behavior of the system

7 0
3 years ago
Write the sum of products, the canonical product of sums, theminterm shorthand and the maxterm shorthand for the following:
dem82 [27]

Answer:

SOP=AB'+B'C

POS=B'(A'+C)

Shorthand Minterms=m₀+m₁+m₅

Shorthand Maxterms=M₃+M₂+M₄+M₆+M₇

Explanation:

For the full explanation of this question refer to the image attached which is of the k-Map of F.As we can see in the k-map that there are only 3 ones.by making 2 pairs of 1 we get the SOP expression.

Rest of them are zero from there we will get the POS expression.

The one's in the k-map represent the Minterms and 0's represent Maxterms and the number written in the box is their respective minterm and maxterm number.Minterms are represented by m and maxterms are represented by M.

7 0
4 years ago
Other questions:
  • The total cost of a DUI could be as high as----- dollars?<br> a100<br> b500<br> c1000<br> d8000
    15·2 answers
  • To transfer data packets between two or more networks, a ________ is used.
    11·1 answer
  • Given a double variable named areaofsquare write the necessary code to read in a value , the area of some square, into areaofsqu
    9·1 answer
  • Websites whose URL’s contain tildes (~) are usually published by the government. True or false?
    8·2 answers
  • Which tool is used to plan a web site?<br> HTML<br> Storyboard<br> Text editor<br> WYSIWYG
    5·2 answers
  • Game design colleges anyone know the requirements??
    15·1 answer
  • Authentication is a mechanism whereby unverified entities or supplicants who seek access to a resource provide a label by which
    12·1 answer
  • Class function which is called automatically as soon as the object is created is called as __
    6·1 answer
  • Arrange these steps of creating a presentation in the correct order. (notice that the given order is incorrect other than the ba
    13·1 answer
  • // This pseudocode segment is intended to compute the number
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!