answer.
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
Elena L
2 months 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:
Amiraneli [1K]2 months ago
4 0
#1 is incorrect since it stops and returns false if the first character isn't lowercase, disregarding the other characters. To correct this, you can eliminate the else: clause and place the return False statement outside the loop. This way is more efficient; the function can return true as soon as it encounters a lowercase letter. It only has to loop to the end if no lowercase letters are found.
You might be interested in
Identify the correct XHTML syntax for inserting an image as a hyperlink from the options provided. A. book.gif B. C. D.
Harlamova29_29 [1022]
The correct method for inserting an image as a hyperlink is outlined in the explanation section.
4 0
2 months ago
If Mark is developing a website to be optimized for mobile devices, what would be the top-level domain?
Rzqust [1037]
The top-level domain (TLD) is the highest level in the domain name system (DNS) hierarchy. In the context of the Internet's DNS, the TLD is operationally positioned within the root zone of the namespace. Generally,.com is regarded as the premier choice, followed closely by.net and.org. For a website tailored for mobile optimization,.com would be the most suitable option.
5 0
2 months ago
Sean is white hat hacker, who is demonstrating a network level session hijack attacks and as part of it, he has injected malicio
amid [951]

Answer:

The type of session hijacking attack that Sean is illustrating is Blind Hijacking, option C.

Explanation:

This is because he is inserting harmful data or commands into the compromised communications within the TCP session, regardless of the source-routing being turned off. He is capable of sending the data or commands, but does not have the ability to view the responses.

3 0
2 months ago
Write an expression that will print "Dollar or more" if the value of num_cents is at least a dollar (100 cents is a dollar). Sam
amid [951]
num_cents = 109 if num_cents >= 100: print('Dollar or more') else: print('not a dollar')
7 0
2 months ago
Your computer uses 4 bits to represent decimal numbers (0, 1, 2, 3 and so on) in binary. What is the SMALLEST number for which a
amid [951]

Response: C

Clarification:

The reason is that four binary bits are insufficient to represent the number sixteen. The maximum is 15.

3 0
4 months ago
Other questions:
  • The part of the computer that contains the brain, or central processing unit, is also known as the A.monitor B.modem C.keyboard
    10·1 answer
  • Write a function solution that returns an arbitrary integer which is greater than n.
    13·1 answer
  • Edhesive 2.3 code practice question 1​
    11·1 answer
  • for question 1-3, consider the following code what is output if the user types in 9? click all that apply A, B, C, D click all t
    13·1 answer
  • Any software or program that comes in many forms and is designed to disrupt the normal operation of a computer by allowing an un
    13·1 answer
  • 1.Which of the following class definitions defines a legal abstract class?a. class A { abstract void unfinished() { } }b. class
    7·1 answer
  • Supervisor: You will need to consolidate your trouble tickets
    10·1 answer
  • Which one of the following provides an authentication mechanism that would be appropriate for pairing with a password to achieve
    13·1 answer
  • Which are types of lines? Choose three answers.
    9·1 answer
  • . When you have multiple graphics positioned on a page, you can _______________ them so that they are a single graphic instead o
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!