inglecindy3184 inglecindy3184
  • 02-01-2020
  • Computers and Technology
contestada

in python Write a loop that counts the number of lowercase characters that appear in the string referenced by mystring.

Respuesta :

ijeggs
ijeggs ijeggs
  • 03-01-2020

Answer:

mystring = "My name is David Acheme"

count = 0

for i in mystring:

    if(i.islower()):

        count=count+1

print("The number of lowercase characters in: "+mystring)

print(count)

Explanation:

1. We declare a String Variable and assign a value.

2. Intialize a count variable to zero.

3. Using a for loop is to loop through each characters in the string.

4. The if condition checks when a lower case character is encountered using the islower method and increases count by 1

5. Prints the value of count.

Answer Link

Otras preguntas

A bottle rocket that was made in science class had a trajectory path that followed the quadratic equation y=-x^2+4x+6. What is the turning point of the rocket's
why did  the volcano explode
what is the cell cycle??
after clicking the start button on your computer screen desktop what option would you then select to examine system components you might want to modify?
which expression is equivalent to x^4-y^4?
Identify the turning point of the function f(x)=x^2-2x+8 by writing its equation in vertex form. Show work
how many books did Harriet beecher stowe write?
Identify the turning point of the function f(x)=x^2-2x+8 by writing its equation in vertex form. Show work
Which of the following oxides can dissolve in water to form a solution that would turn litmus indicator red in color? a. MgO b. K₂O c. CO₂ d. ZnO e. H₂O
do you know how to say my in Spanish?