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
What is the name for an object that is what it appears to be?
Gnesinka [82]
That would be a symbol
8 0
2 years ago
QUESTION
Lady_Fox [76]

Answer:

Explanation:

#include <iostream>

using namespace std;

int main ()

{

   int responses[30],count[6];

   int score = 0;

   string resp = " ";

   for (int i = 0; i < 30; i++)

   {

    responses[i] = 0;

   }

   for (int i = 0; i < 6; i++)

   {

    count[i,1]=0;

    count[i,2]=0;

    count[i,0]=0;

   }

   while ((resp != "Y") && (resp != "y"))

   {

    for (int i = 0; i < 30; i++)

    {

        while ((score > 5) || (score < 1))

           {

            cout << "Student " << (i+1)<< " please enter a value (1-5):";

            cin >> score;

        }

           responses[i] = score;

           if((score > 5)||(score<1))

           {

               if(score==1) count[1]++;        

               if(score==2) count[2]++;        

               if(score==3) count[3]++;        

               if(score==4) count[4]++;        

               if(score==5) count[5]++;        

           }

           score = 0;

    }

    cout<< "Response               Frequency              Percentage"<<endl;;

    cout<< "    1                      "<<count[1]<<"               "<<(count[1]/30)<<"%"<<endl;

    cout<< "    2                      "<<count[2]<<"               "<<(count[2]/30)<<"%"<<endl;

    cout<< "    3                      "<<count[3]<<"               "<<(count[3]/30)<<"%"<<endl;

    cout<< "    4                      "<<count[4]<<"               "<<(count[4]/30)<<"%"<<endl;

    cout<< "    5                      "<<count[5]<<"               "<<(count[5]/30)<<"%"<<endl;

    cout<< "Do you want to exit? Press Y to exit any other key to continue: ";

    cin>> resp;

   }

   return 0;

}

8 0
3 years ago
Which wireless standard has bandwidth up to 54 Mbps and signals in a regulated frequency spectrum around 5 GHz?
Tamiku [17]

Answer:

802.11a

Explanation:

802.11a supports bandwidth of 54 Mbps in a regulated frequency spectrum of 5 GHz. 802.11a also referred to as Wi-fi 2. 802.11a is basically costs higher than 802.11b though both were created at the same time. Hence 802.11b is more popular than 802.11a . All of them are developed by IEEE.

4 0
3 years ago
Which type of cause and effect organizer would be best for alisha to understand how crude oil becomes gasoline?
sukhopar [10]
The answer is 100% B. Flow chart.
5 0
3 years ago
Read 2 more answers
Which tool do web designers use to select colors that complement each other?
DaniilM [7]
•color pick eye dropper chrome extension
•color snapper2
•happy hues
•coolors
3 0
1 year ago
Other questions:
  • Cyber security includes which of the following?
    7·1 answer
  • Which of the following is a type of monitor port?
    10·1 answer
  • A _____ is a machine that changes information from one form into another.
    7·1 answer
  • Which of these are examples of a Single Sign-On (SSO) service?
    5·1 answer
  • Technician A says that front and rear U-joints on a RWD axle should operate at different angles to prevent vibration. Technician
    10·1 answer
  • When discussing the data-modeling building blocks, anything (a person, a place, a thing, or an event) about which data are to be
    15·1 answer
  • Which statement describes one drive?
    6·1 answer
  • You are tasked with leading a project to build a custom software testing tool for client. You have been provided with a set of p
    7·1 answer
  • What is the difference between EPROM and EEPROM, explain why​
    11·1 answer
  • Which attributes are indicators that a website is reliable? Check all that apply is up to date explains sources of data is an ed
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!