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
harina [27]
3 years ago
7

Python3

Computers and Technology
1 answer:
Tems11 [23]3 years ago
8 0

Answer:

Following are the program in the Python Programming Language:

def countLetter(words):

   #set dictionary

 di = {}

 for i in words: #set for loop

 #if key exists in di or not

   if di.get(i):

 #if exists count increased

     di[i] += 1

   else: #otherwise assign with key

     di[i] = 1

   # return di

 return di

def main():

 #get input from the user

 words = input("Enter the word: ")

 #store the output in function

 letter = countLetter(words)

 #set for loop

 for i in letter:

   print(i, ":", letter[i])  #print output with :

#call main method

if __name__ == "__main__":

 main()

Explanation:

Here, we define the function "countLetter()" and pass the argument "words" in parameter and inside it.

  • we set the dictionary data type variable "di".
  • we set the for loop and pass the condition inside it we set if statement and increment in di otherwise di is equal to 1.
  • we return the variable di.

Then, we define the function "main()" inside it.

  • we get input from the user in the variable "words".
  • we store the return value of function "countLetter()" in the variable "letter".
  • we set for loop to print the output.

Finally, we call the main method.

You might be interested in
Is a storyboard an example of an implemation tool?
goblinko [34]
Yes, the answer is true.
8 0
4 years ago
Read 2 more answers
What protocol is used to access directory listings within active directory or other directory services?
zalisa [80]

The LDAP protocol is used to access directory listings within active directory or other directory services.

LDAP stands for Lightweight Directory Access Protocol. The function of this protocol is to enale access to an existing direcory. LDAP is based on a client-server model.


3 0
4 years ago
10) What is the BEST way to rewrite sentence (1) to make it more
givi [52]
I believe the answer is D. It makes more sense and is the most correct grammatically.

Hope this helped and pls mark as brainliest!

~ Luna
3 0
3 years ago
Read 2 more answers
how do you call the squares method to compute the first five squares and store the result in an array numbers
IRINA_888 [86]

Answer:

The method can be called using:

int[] returnarray = Squares();

<em>Where returnarray represents the name of the array</em>

Explanation:

To answer this, I will make an assumption that the Square method is an int array method (i.e. it returns array).

So, to call the method from main, an array has to be declared to get the values:

int[] returnarray = Squares();

Then an iteration is created to iterate through the array in order to print the array elements.

for (int i = 0; i < returnarray.length; i++)

 System.out.print(returnarray[i]+ " ");    

-------------------------------------------------------------------------------------------

The answer ends here

-------------------------------------------------------------------------------------------

As an addition, the complete program that includes the method and the main is:

<em>public class Main{</em>

<em> public static int [] Squares(){</em>

<em>     int [] arr = new int[5]; </em>

<em>     for(int i = 1;i<6;i++){</em>

<em>         arr[i-1] = i*i;</em>

<em>     }</em>

<em>     return arr;</em>

<em> }</em>

<em> public static void main(String[] args) {</em>

<em>  int[] returnarray = Squares();</em>

<em>  for (int i = 0; i < returnarray.length; i++)</em>

<em>  System.out.print(returnarray[i]+ " ");          </em>

<em> }  </em>

<em>}</em>

8 0
3 years ago
Which type of basic building blocks (constructs) is the following algorithm?
Ksju [112]

Answer:

Sequence

Explanation:

6 0
3 years ago
Other questions:
  • As a bank employee, you often work from home and remotely access a file server on the bank’s network to correct errors in financ
    8·1 answer
  • ​Microsoft claims that the microsoft project software can _____.
    11·1 answer
  • Your mom wants to purchase a computer. She has heard about how the Windows 8 operating system is best-geared for a touch-enabled
    10·2 answers
  • Which of the following laptop features allows users to overcome keyboard size restrictions?
    11·1 answer
  • Mika forgot to put in the function name in his function header for the code below. What would be the best function header?
    12·2 answers
  • One easy way to tell if a cell contains a formula instead of data is to click on the cell and look at the formula bar to
    5·2 answers
  • To specify your preferred colors, fonts, and effects for a document, which of the following should be done?
    9·2 answers
  • Which compound is obtained by the oxidation of primary alcohol with nascent oxygen​
    11·1 answer
  • Pls help quick... will mark brainliest...
    15·1 answer
  • What file can you edit on a linux system to configure shared folders using samba?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!