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

Answers

Answer 1

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.


Related Questions

write a python program to input a list of no. and swap element at the even location with element at odd location​

Answers

Answer:

I changed the title to describe the task the code accomplishes, this makes    the contrnt more easily searchable and accessible.

Explanation:

Answer:

The content is more easily searchable and accessible.

Explanation:

What are the steps for inserting a 3-D reference?
1. Enter the formula up to the point of needing a reference.
2. Activate the first worksheet.
3. While holding the key, activate the last worksheet.
4. Select the cell or range containing the values the formula should refer to.
5. Complete the formula by pressing these two buttons: and .

Answers

Answer:

Shift

Ctrl

Enter

Explanation:

Fault tolerance refers to

Answers

Answer:

B

Explanation:

1) You are working with an organization as a network manager. The organization has

two offices in Abu Dhabi. Each office is equipped with 25 computers. The

management wants the smooth flow of information between both the offices and

does not want any delay.

a. Management has asked you to connect the computers in both the offices with

each other. What type of network will you suggest to them and what can be

some possible benefits of using that network?

b. The management wants that in the Head Office, there can be no access to data

from outside. Which type of network will be your preference to implement in

that case and what will be the benefit of that?

Answers

Answer:

Explanation:

a. In this specific scenario, the best option would most likely be a site-to-site VPN. This would allow each office to be independently connected to the internet and at the same time be connected to each other securely and efficiently. There should be unnoticeable or no delay at all between the two offices and sensitive files will be completely secure. Therefore, the two offices can easily transfer data securely between one another without fear of the data being intercepted.

b.  The same VPN network would work on the head office, but instead we can implement firewall restrictions to the head office network itself. These restrictions would prevent any or all incoming connections that are trying to request data from the local head office network. This would allow the head office to continue working without worry of unwanted intruders in their network.

Question:
True or False: How we interact with computers is an important consideration for
programmers and computer scientists. Our interaction drives the goal of ethical and
effective technology.
True or false

Answers

Answer:

Explanation:

I don't see a way of making this false. The study of what people do with computers and how they do it has to lead to some sort of conclusion about ethics. Ethics, after all, is the study of what we should do. And even better what we should be doing that results in good.

It also makes for effective technology. Appeal to our use of computers and combine it with what we should be doing has to make a more effective technology.

Write a basic
to solve
30x10​

Answers

Answer:

30x10

Explanation:

3 times 10 = 30

30 times 10 = 300

Answer:

30x10​=300

Explanation:

3x10=30

30x10= 300

(just add another zero, if that makes sense)

Write a method that returns a String that is just the first and last character of the given string Your return value should be only two characters long. You can assume that the given string will not be empty.​

Answers

Answer:

The method in Java is as follows:

public static String returnlen(String input){

   String output = ""+input.charAt(0)+input.charAt(input.length()-1);

   return output;

}

Explanation:

This defines the method

public static String returnlen(String input){

This concatenates the first and the last character of the input string

   String output = ""+input.charAt(0)+input.charAt(input.length()-1);

This returns the concatenated string

   return output;

}

In a sport like baseball, which of the following could be considered a “rule”?

following an umpire’s decision on whether a pitch is a ball or a strike

the force of gravity on the ball

the kinds of safety equipment players are asked to wear

all of the above

Answers

The answer is all of the above since safety is a priority but when you swing the bat you have to make sure you use enough force.

Hope this helps mark me brainliest please

. Suppose client A initiates an FTP session with server S. At about the same time, client B also initiates an FTP session with server S. Provide possible source and destination port numbers for: (a) the segments sent from A to S? (b) the segments sent from B to S? (c) the segments sent from S to A? (d) the segments sent from S to B? (e) If A and B are different hosts, is it possible that the source port numbers in the segments from A to S are the same as those from B to S? (f) How about if they are the same host?

Answers

Answer:

Follows are the solution to this question:

Explanation:

The segments send port "A to S" numbers below 1024 and use 1024 and 65535 as standard numbers, that are using as a temporary connection. The port number for Server "S" is =23, and the port number for Client"A" is between 1024 and 65535, and its standard value is 467, and other calculation can be defined in the table:

  [tex]Serial \ \ \ \ \ \ \ \ \ \ \ \ \ port \ \ number \ \ \ \ \ \ \ \ \ \ \ \ \ Destination \ port\ number[/tex]

  [tex]a) A \to S \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 467 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 23\\\\b) B \to S \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 513 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 23\\\\c) S \to A \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 23 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 467\\\\d) S \to B \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 23 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 513\\\\[/tex]

  [tex]e) Yes\\\\f) No\\\\[/tex]

Edhesive 6.8 lesson practice answers

Answers

Answer:

1.) 25 ; 15 ; 15

2.) 50 ; 15 ; 50

Explanation:

In the first function written :

The variable val was initially decaled or assigned a value of 25 and that was what was printed first.

However, after the example function was written, the val variable was finally assiagned a value of 15 within the function. However, it was also declared that the global variable takes uonthe val value. Hence, the val variable initially assigned a value, of 25 changes to 15 globally.

For the second code :

From the top:

Val was assigned a value of 50 ;

Hence,

print(val) gives an output of 50

Within the function definition which prints the value of val that is assigned a value of 25 within the function.

Since tbe global variable isnt reset.

Printing Val again outputs 50;since ito is outside the function.

The code output description can be defined as follows:

Code Explanation:

In the first code, a "val" variable is declared that hold an integer value.In the next step, a method "example" is defined.Inside the method a global keyword is used that define a variable "val" in which it hold an integer value and print its value.After defining a method two print method is used that print "val" variable value and call exmaple method.In the second code, a "val" variable is declared that hold an integer value.In the next step, a method "example" is defined.Inside the method another variable "val" is defined in which it hold an integer value and print its value.After defining a method two print method is used that print "val" variable value and call exmaple method.

Code:

val = 25 #defining a variable val that holds an integer value

def example(): #defining a method example

   global val #using keyword global to define variable val

   val = 15#defining an integer variable that hold integer value

   print (val)#print global variable value

print (val) #print val variable value

example()#calling example method

print (val)#print global variable value

print("----------------------------------------------------")

val = 50 #defining a variable val that holds an integer value

def example(): #defining a method example

   val = 15 #define variable val that holds integer value  

   print(val)#print val variable value

print (val) #print val variable value

example() #calling method example

print (val)#print val value

Output:

Please find the attached file.

Learn more:

brainly.com/question/21866333

It is the "executable" phrase of Word
Wide Web with dynamic applications,?

Answers

Answer:

It is the “executable” phrase of Word Wide Web with dynamic applications, interactive services, and “machine-to-machine” interaction. In Web 3.0, computers can interpret information like humans and intelligently generate and distribute useful content tailored to the needs of users.

Good HTML skills will be required in order to prevent what from happening in the design of a web page?

Answers

Answer:

to properly use the tags in the web page

Explanation:

The full form HTML is Hyper Text Mark up Language. HTML is used in designing a good web page in the computer. It is used to design the document that are displayed in the web browser.

Instead of using a programming language to do the functions of a web page, the markup language uses the tags to identify the different types of the contents and purposes that they serve in the web page. A good HTML skills are required to prevent the web page from any improper designing of the contents in the web page.

Marissa is designing a web page that features lessons on how to build cabinets. how can she make the page most engaging for the user?

A. by adding warm colors to make the content more fun to view.

B. by adding a short video demonstrating how to build cabinets.

C. by adding a variety of font types to make the text look appealing.

D. by adding a slideshow that displays pictures of built cabinets.​

Answers

I am pretty sure it’s B because that’s the only answer that really correlates to teaching people how to build cabinets

Factorise (x+y)^3- (x^3+y^3)​

Answers

Answer:

3xy(x+y)

Explanation:

if you want to simplify it it's 3x^2y+3xy^2 but you said factorise so it should be the answer 3xy(x+y)

Hope this helps:)

Answer:

3xy (x +y)

Explanation:

Step 1 Evaluate: (x+y)^3 = x^3+3x^2y+3xy^2+y^3

Step 2 Pull out like terms: 3x^2y+3xy^2 = 3xy × (x+y)

Answer:

3xy (x +y)

why is it important to use fillings,coating/icing,glazes or decorations for pastry products​

Answers

Answer:

Frosting improves the cake's appearance.

Explanation:

Special occasion cakes become more festive with frosting and decorations; and, Frosting improves the keeping the qualities of the cake by forming a protective coating around it, sealing in moisture and flavor and allowing it to be eaten over a couple of days.

I tried going into a website called Utters.io, but when I typed a phrase in, the video was taking a really long time to load. Does anyone know what's wrong with it?

Answers

Answer:

Your internet or browser

Explanation:

Try another browser or resetting your router. If a YT video will load then you can rule out internet speed and try another piece of client software.

What does a file extension tell your computer?

A. What type of program to open

B. When the file was created

C. Where a program is saved

D. Which file name to display

Answers

Answer:

A. what type of program to open

Help please....
If you decide to work for yourself to develop apps for sale rather than for a company, you are known to be working_________

Answers

Explanation:

independently is correct

The network administrator is important in keeping the network healthy. Which of the following describes the role of a network administrator? Check all of the boxes that apply.

Answers

C and D. Network Administrators are more like managers of a network, so they’re more likely to be doing logical maintenance as opposed to physical. Physical network and hardware maintenance is typically done by a network technician or an I.T. technician.

Answer:

Its A and D

Explanation:I did it on edge 2020

Why is it important to think about the programming language to use?

A) Some programming languages might be too complicated.
B)Some programming languages are better on different platforms.
C)The choice of programming language determines what type of game you
can make.
D)Some programming languages are used more in some countries.

Answers

The reason that is important to think about the programming language to use is option C)The choice of programming language determines what type of game you can make.

Why should one consider their programming language of choice?

The ability to communicate clearly and concisely as well as develop more advanced analytical skills can both be benefited from knowledge of programming languages. Instead of displaying raw data straight from the source, BASIC is a high-level language that enables the programmer to access simpler, more consolidated facts and operations.

Note that Knowing numerous programming languages improves your ability to think creatively and effectively solve problems and enables you to accomplish your goals in novel ways. The more programming languages you know how to use, the easier it will be for you to solve a particular problem and the more adaptable you will be as a developer.

Learn more about programming language  from

https://brainly.com/question/16936315
#SPJ1

Use the drop-down menu to complete the steps for creating a scenario.
1. Go to the
tab.
2. In the
group, select
from the drop-down What If Analysis menu.
3. Click the Add button.
4. Specify the name of the scenario.
5. Specify the cells containing the values to change and click OK.
6. Specify
and click OK

Answers

Answer:

1. Data

2. Forecast

3. Scenario Manager

4. values for the changing cells

Explanation:

On edge

What would you do if you experienced academic frustrations in school? Check all that apply.
Look for ways to do better academically in school.
Ask a friend to explain difficult concepts.
Try to identify the reason you are feeling frustrated.
Ask a teacher for help coming up with a solution.
Search online for help solving this problem.

Answers

I think it is all of them :))

Answer: all are correct

Explanation:

i say all because those are all really good ways to help you in school. if you are struggling then ask a to a teacher for help you, if you need more help, ask a friend. see what you can do to help yourself do better. see what you are doing that could possibly be the reason of your frustrations. and the internet is always open to questions and answers. but it also depends, some schools are strict about using the internet for answers. but if your school is different then use the internet freely. i hope this helped.

HTML code to display square bullets in an unordered list​

Answers

Answer:

<!DOCTYPE html>

<html>

<body>

<h2>Unordered List with Square Bullets</h2>

<ul style="list-style-type:square;">

 <li>Coffee</li>

 <li>Tea</li>

 <li>Milk</li>

</ul>

</body>

</html>

Answer urgently needed!!!



•write 5 differences between pin and password​

Answers

Answer: Here Are Some Of Them

a Personal Information Number (PIN) allows you to prove that you're you, so that no one else can access your data. The obvious difference is that a PIN is limited to numerical digits (0-9), while a password can contain numerical digits, upper- and lowercase letters, and punctuation. PINs can facilitate a quicker, more usable experience. Signing in with a shorter PIN code instead of a password might help somewhat with issues related to password usability and fatigue.  Signing in with a shorter PIN code instead of a password might help somewhat with issues related to password usability and fatigue

Explanation:

How to make videos that I watch online not buffer and stop so much? it's really annoying.​

Answers

I would recommend buying a higher quality device. This might be happening because you device is old. If not then I’m not sure.

I hope this helps.

Answer:

Delete ittttttttttttt


Avi does not want to save his internet browsing details on his computer. What should he do?
Avi should (copy,delete,or save) all the(virus,cookies,or logs) from his system after he has finished browsing.

Answers

He should delete logs.

1. What is the difference between operating systems and application software? (1 point)

Answers

The main difference between operating system and application software is that an operating system is a system software that works as the interface between the user and the hardware while the application software is a program that performs a specific task. This software assists the tasks of the system

write a loop that will input 8 numbers from the keyboard and find the sum

Answers

THIS IS FOR PYTHON

total = 0

for i in range(8):

    number = int(input('Number: '))

    total += number

print(total)

The loop that will input 8 numbers from the keyboard and find the sum is as follows:

user_input = [int(input('Enter your value: ')) for i in range(8)]  

print(sum(user_input))

The code ask for the user's input for 8 times. Recall the range is 8.

Then we loop through the users input values

The looped users input will be summed using the sum() function. The sum function sums all the users input value.

The summed value is then printed with the print statement.

learn more on loop: https://brainly.com/question/14201070?referrer=searchResults

Describe how a black and white image could be represented in binary

Answers

Images known as binary images include pixels with only two possible intensities. Normally, they are shown in black and white. In terms of numbers, the two values are frequently 0 for black and 1 or 255 for white.

What represents of black and white image in binary?

Each pixel in an image is made up of binary numbers. Binary may be used to make a straightforward black-and-white image.

If we declare that 1 represents black (or on) and 0 represents white (or off). A grid can be laid out and the squares colored to form the image (1 – black and 0 – white).

The most well-known instance of monochrome photography is black and white photography, which only uses neutral gray colors to depict its topics.

Therefore, tones of a single hue are used in monochrome photography to represent all the other colors in an image.

Learn more about binary here:

https://brainly.com/question/3708556

#SPJ2

What is the best programing language to use for building video games?

Answers

hey

I'm going to college for game design.

one of the best languages and the one I'm studying in is c# it is used in unity and many other game engines but there are many more. Just to list a few c++, Java, and many more it is up to you. if you would like more info about this just let me know By the way what game are you planning to make that is one of the most important factors

Hope this helps

-scav

Other Questions
3,012 divided by 7 long division Describe effective communication strategies for gathering information, educating patients Jonah bought a gym membership for$20 per month. He pays an additional$4 each time he attends a mixedmartial arts class. He has spent $108over the last four months.How many mixed martialarts classes has heattended? THE ANSWER IS NOT BIf you cant see the picture plz zoom in.The box plots show Theo's math scores and language arts scores.About 50% of Theo's scores are in which range for each subject?60 to 85 for math: 60 to 80 for language arts55 to 90 for math: 50 to 90 for language arts55 to 60 for math: 50 to 60 for language arts85 to 90 for math 80 to 90 for language arts HELP HELP PLSS PLSS I REALLY NEED HELP Martin runs three fourths mile three days a week. How many miles does he run in four weeks?9 milesnine and one third miles6 milessix and two thirds miles acronym training keywords Who are the people influencing you? How are they helping shape your story? What makes them appealing to you? "4 times the difference of 3 and y"A: 1-yB:4(3-y)C:3(4-y)D:4x(3-y) List the ir verbs in the sentence. Escribs a la profesora que ensea la clase? Question 1Part AWhich statement best explains how hope is treated in both "Malala the Powerful" and "The Strangers That Came to Town"?In "Malala the Powerful," Malala receives cards from many supporters; in "The Strangers That Came to Town," Mr. Duvitch works at a meatpacking plant.In "Malala the Powerful," Malala's father refuses to shut down his school; in "The Strangers That Came to Town," Father punishes Tom and Andy for their prank.In "Malala the Powerful," Malala's efforts help more girls go to school; in "The Strangers That Came to Town," the Duvitches are finally accepted by their neighbors.In "Malala the Powerful," Malala has to go through several surgeries to recover; in "The Strangers That Came to Town," Andy and Tom replace the Duvitches' fish.Question 2Part BWhich details from "Malala the Powerful" and "The Strangers That Came to Town" best support the answer to Part A?Select two correct answers.The Malala Fund, created in her name, is helping to send 40 girls in Pakistan to school.Some 132 million children and teens around the world do not attend school, often because they must work to help support their families or because they have no school to go to."'Get into the rowboat,' Father said in the same steely tones. 'You are not to come back until you've caught sixty-one fish to repay Mr. Duvitch."So they started inviting Mr. and Mrs. Duvitch to the community parties. It wasn't long before the Duvitch boys and girls started making friends in the community." help me please !!!!!!!!!!!! Describe how to find the slope and y intercept of 2x+3y=6, then describe how would you graph the line. can anyone make speech about 5minutes? I will give0.45104 solve the equation 3tan(2x+15)=4 for 0is less than equal to x and 180 is greater than equal to x. Amanda must read a 259page book for her history class over the next week. Amanda has found that she can read 37 pages in a hour. Complete the table, select the appropriate graph, and enter an equation to represent the number of pages that Amanda has left to read with relation to time. Use variable x for hours. How would you feel if everyone hated you? Solve for the system of equations using elimination Can someone answer the question pls?