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
Sauron [17]
3 years ago
5

write a function solution that given an integer n returns a string consisting of n lowercase lettersn

Computers and Technology
1 answer:
melomori [17]3 years ago
3 0

Answer:

Following are the method to this question:

def solution(s):#defining a method solution

   x=0#defining variable x that assign value 0

   for i in s:#defining for loop to count string value in number

       if(i.islower()):#defining if block that check input character is in lowercase

           x=x+1#increment the value of x by 1

   return x#return x

s=input("Enter string:")#defining s variable that input string value

print(solution(s))#defining print method to solution method                    

Output:

Enter string:Database is the colloection

22

Explanation:

In the given question some data is missing, that's why we define the answer as follows:

  • In the above code, a solution method is defined, which takes "s" variable as the parameter, and inside the method, an integer variable "x" is defined, that holds a value that is "0".
  • In the next line, for loop is declared, that counts string value without space and inside the loop, if block is defined, that checks only the lowercase character and adds the value in x variable, and returns its value.
  • Outside the method s variable is defined, that inputs the string value from the user end, and use the print method to call it and print its calculated value.
You might be interested in
HELP URGENT
hram777 [196]
You should structure the text first before you search for a relevant picture
7 0
3 years ago
Read 2 more answers
Help pleaseeeeeeeeeeeee
viktelen [127]
By dragging its borders
7 0
3 years ago
Read 2 more answers
Which is worse: Fast charging (Due to heat) or unplugging before reaching full capacity (On a normal charge)?
Ray Of Light [21]
Unplugging before reaching Capacity
4 0
3 years ago
In QBasic, create a number guessing challenge. Your program should generate a random number from 1-
Sergio039 [100]

Answer:

yes

Explanation:

6 0
2 years ago
Find an interesting case on the concept of intellectual property
Monica [59]

Answer:

jzsvxysbxydvxhaxabevxusx

5 0
2 years ago
Other questions:
  • In a system using the fixed partitions memory allocation scheme, given the following situation (and using a decimal form): After
    9·1 answer
  • Hey I don’t have a question I’m just testing something on this app
    6·2 answers
  • How do optical discs store data? select one:
    15·1 answer
  • Which of these is not the correct method for moving text in a document in Word 2016?
    14·2 answers
  • I need some asap pls
    9·2 answers
  • Create a PHP page that contains an array of at least 20 movie titles or book titles (your choice). The HTML page should have an
    7·1 answer
  • Where does Reiner take eren after they have a fight?
    7·2 answers
  • Any my hero academia fans out there don't report at all just what more friends to
    14·2 answers
  • A good information that contains the facts necessary for decision makers to solve a problem is characterized by the __________.
    15·2 answers
  • The RGB value below produces a shade of purple. What does the number 175
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!