Write a function that displays the character that appears most frequently in the string. If several characters have the same highest frequency, displays the first character with that frequency. Note that you must use dictionary to count the frequency of each letter in the input string. NO credit will be given without using dictionary in your program

Answers

Answer 1

Answer:

The function is as follows:

def getMode(str):

occurrence = [0] * 256

dict = {}

for i in str:

 occurrence[ord(i)]+=1;

 dict[i] = occurrence[ord(i)]

 

highest = max(dict, key=dict.get)

print(highest)

Explanation:

This defines the function

def getMode(str):

This initializes the occurrence list to 0

occurrence = [0] * 256

This creates an empty dictionary

dict = {}

This iterates through the input string

for i in str:

This counts the occurrence of each string

 occurrence[ord(i)]+=1;

The string and its occurrence are then appended to the dictionary

 dict[i] = occurrence[ord(i)]

This gets the key with the highest value (i.e. the mode)

highest = max(dict, key=dict.get)

This prints the key

print(highest)


Related Questions

You work for a large company that has over 1000 computers. Each of these computes uses a wireless mouse and keyboard. Therefore, your company goes through a lot of alkaline batteries. When these batteries can no longer power the intended device, you must decide what to do with them. Unless otherwise dictated by your local authorities, which of the following would be the EASIEST way to deal with these batteries?
They must be sent to hazardous waste collection

a. They can be recharged.
b. They must be stored onsite until they expire
c. They can be thrown in the trash.

Answers

The answer to this question is, "They can be thrown in the trash."

Explanation: This is because it specifies how to get rid of them UNLESS local authorities have told you otherwise.


Which statement describes Augmented Reality (AR) technology?

Answers

Answer:

Augmented Reality (AR) superimposes images and audio over the real world in real time. It does allow ambient light and does not require headsets all the time.

yan po ang szgot

wala po kasi pagpipilian

HOPE IT HELPS

pls follow ke

write a program that takes as input a number of kilometers and prints the corresponding number of nautical miles.

Answers

Answer:

try this

Explanation:

km = float(input('Kilometers: '))

nm = (km * 5400) / 10000

print('%0.4f km = %0.4f Nautical Miles' %(km,nm))

Write a program to implement problem statement below; provide the menu for input N and number of experiment M to calculate average time on M runs. randomly generated list. State your estimate on the BigO number of your algorithm/program logic. (we discussed in the class) Measure the performance of your program by given different N with randomly generated list with multiple experiment of Ns against time to draw the BigO graph (using excel) we discussed during the lecture.

Answers

Answer:

Explanation:

#include<iostream>

#include<ctime>

#include<bits/stdc++.h>

using namespace std;

double calculate(double arr[], int l)

{

double avg=0.0;

int x;

for(x=0;x<l;x++)

{

avg+=arr[x];

}

avg/=l;

return avg;

}

int biggest(int arr[], int n)

{

int x,idx,big=-1;

for(x=0;x<n;x++)

{

if(arr[x]>big)

{

big=arr[x];

idx=x;

}

}

return idx;

}

int main()

{

vector<pair<int,double> >result;

cout<<"Enter 1 for iteration\nEnter 2 for exit\n";

int choice;

cin>>choice;

while(choice!=2)

{

int n,m;

cout<<"Enter N"<<endl;

cin>>n;

cout<<"Enter M"<<endl;

cin>>m;

int c=m;

double running_time[c];

while(c>0)

{

int arr[n];

int x;

for(x=0;x<n;x++)

{

arr[x] = rand();

}

clock_t start = clock();

int pos = biggest(arr,n);

clock_t t_end = clock();

c--;

running_time[c] = 1000.0*(t_end-start)/CLOCKS_PER_SEC;

}

double avg_running_time = calculate(running_time,m);

result.push_back(make_pair(n,avg_running_time));

cout<<"Enter 1 for iteration\nEnter 2 for exit\n";

cin>>choice;

}

for(int x=0;x<result.size();x++)

{

cout<<result[x].first<<" "<<result[x].second<<endl;

}

}

A network consists of 75 workstations and three servers. The workstations are currently connected to the network with 100 Mbps switches, and the servers have 1000 Mbps connections. Describe two network problems that can be solved by replacing the workstations' 100 Mbps switches and NICs with 1000 Mbps switches and NICs. What potential problems can this upgrade cause

Answers

Answer:

A)  i) starvation  ii) flow control

B) Network congestion

Explanation:

A) Network problems that can be addressed / solved

By replacing the workstations 100 Mbps switches with 1000 Mbps switches the problem of

Starvation;  been faced by the servers due to the delay in sending data to be processed by the servers from the workstations will be resolved .

Flow control : The huge difference in the speeds of the workstations and servers causes a network buffer which leads to packet loss therefore when the workstations 100 Mbps switch is replaced with 1000 Mbps switch this network problem will be resolved

b) The potential problem that can be encountered is Network Congestion

list and describe each of the activities of technology

Answers

Answer:

network has led to exposure of dirty things to young ones.

air transport has led to losing of lives

PLEASE HELP ASAP!!

This command allows you to duplicate text from one part of a document while keeping the original text.

Cut
Copy
Format
Paste

Answers

The answer to your question is= Copy

Answer: CTRL + C or copy and paste

Explanation: to copy and paste highlight text by dragging mouse or clicking on touchpad and holding over selected text, if not on a computer but on a touch screen device ( ex: Phone, iPad etc) hold down until it is blue use the tear drops from the top and bottom to highlight the text you need. Then hold down the blue area until options come up stop holding and select copy and then go to where you want to put the text and hold down again and select paste. If on computer drag cursor over text while holding down on left click or holding down on touchpad, it will highlight light blue then left click or click on the touchpad with both fingers and repeat the process of copying and pasting as said before.

Hope this helps! :)

Linda wants to change the color of the SmartArt that she has used in her spreadsheet. To do so, she clicks on the shape in the SmartArt graphic. She then clicks on the arrow next to Shape Fill under Drawing Tools, on the Format tab, in the Shape Styles group. Linda then selects an option from the menu that appears, and under the Colors Dialog box and Standard, she chooses the color she wants the SmartArt to be and clicks OK. What can the option that she selected from the menu under Shape Fill be

Answers

Answer: Theme colors

Explanation:

Based on the directions, Linda most probably went to the "Theme colors" option as shown in the attachment below. Theme colors enables one to change the color of their smart shape.

It is located in the "Format tab" which is under "Drawing tools" in the more recent Excel versions. Under the format tab it is located in the Shape Styles group as shown below.

All of the following can cause a fatal execution-time error except: Group of answer choices Dereferencing a pointer that has not been initialized properly Dereferencing a null pointer Dereferencing a pointer that has not been assigned to point to a specific address Dereferencing a variable that is not a pointer

Answers

Answer: Dereferencing a variable that is not a pointer

Explanation:

The execution time also refered to as the CPU time pertaining to a given task is the time that is used by the system to execute a task.

Some of the reasons for a fatal execution-time error include:

• Dereferencing a pointer that has not been initialized properly

• Dereferencing a null pointer

• Dereferencing a pointer that has not been assigned to point to a specific address.

It should be noted that dereferencing a variable that is not a pointer doesn't cause a fatal execution-time error.

What will the declaration below do to its target?

animation-direction: reverse;
The animation steps will play backward.
The animation steps will play forward, then backward.
The animation steps will play forward.
The animation steps will play backward, then forward.

Answers

The animation steps will play forward then backward

hello! can someone write a c++ program for this problem

Problema 2018.3.2 - Cheated dice
Costica is on vacation and his parents sent him to the country. There he gets terribly bored and looking through his grandfather's closet, he came across a bag full of dice. Having no one to play dice with, but it seemed to him that some of the dice were heavier than the others, Costica chose a dice and started to test it by throwing it with him and noting how many times each face fell. He then tries to figure out whether the dice are rolled or not, considering that the difference between the maximum number of appearances of one face and the minimum number of occurrences (of any other face) should not exceed 10% of the total number of throws.
Requirement
Given a number N of dice rolls and then N natural numbers in the range [1: 6] representing the numbers obtained on the rolls, determine whether the dice is tricked according to the above condition.
Input data
From the input (stdin stream) on the first line reads the natural number N, representing the number of rolls. On the following N lines there is a natural number in the range [1: 6] representing the numbers obtained on throws.
Output data
At the output (stdout stream) a single number will be displayed, 0 or 1, 0 if the dice are normal, and 1 if it is cheated.
ATTENTION to the requirement of the problem: the results must be displayed EXACTLY in the way indicated! In other words, nothing will be displayed on the standard output stream in addition to the problem requirement; as a result of the automatic evaluation, any additional character displayed, or a display different from the one indicated, will lead to an erroneous result and therefore to the qualification "Rejected".
Restrictions and clarifications
1. 10 ≤ N ≤ 100
2. Caution: Depending on the programming language chosen, the file containing the code must have one of the extensions .c, .cpp, .java, or .m. The web editor will not automatically add these extensions and their absence makes it impossible to compile the program!
3. Attention: The source file must be named by the candidate as: . where name is the last name of the candidate and the extension (ext) is the one chosen according to the previous point. Beware of Java language restrictions on class name and file name!
Input data

10
6
6
6
6
6
6
6
6
6
6
Output data
1

Roll the dice 10 times, all 10 rolls produce the number 6. Because the difference between the maximum number of rolls (10) and the minimum number of rolls (0) is strictly greater than 10% of the total number of rolls (10% of 10 is 1), we conclude that the dice are oiled.

Input data
10
1
4
2
5
4
6
2
1
3
3
Output data
0

Throw the dice 10 times and get: 1 twice, 2 twice, 3 twice, 4 twice, 5 and 6 at a time. Because the difference between the maximum number of appearances (two) and the minimum number of occurrences (one) is less than or equal to 10% of the total number of throws (10% of 10 is 1), we conclude that the dice are not deceived.

Answers

Answer:

f0ll0w me on insta gram Id:Anshi threddy_06 (no gap between I and t)

8. (a) Write the following statements in ASCII
A = 4.5 x B
X = 75/Y

Answers

Answer:

Explanation:

A=4.5*B

65=4.5*66

65=297

1000001=11011001

10000011=110110011(after adding even parity bit)

X=75/Y

89=75/90

10011001=1001011/1011010

100110011=10010111/10110101(after adding even parity bit)

Select the correct answer.
What is the advantage of using transparencies?
O A. They support better image quality than online presentations.
O B. They are helpful when creating non-linear presentations.
OC. They allow the presenter to jot down points on the slide.
OD. They are better suited to creating handouts.
Reset
Next

Answers

Answer:

They are better suited to creating handouts

If AX contains hex information 2111 and BX contains hex information 4333, what is the content in BX in hex format after performing ASM instruction ADD BX, AX

Answers

Answer:

BX will hold 6444 in hex format.

Explanation:

From the given information:

We need to understand that AX is 64-bit hex number.

When performing ASM instruction (Assembly language instruction),

The addition of 2111 + 4333 = 6444 will be in BX.

This is because ADD, BX, AX will add bx and ax; and the final outcome will be stored in BX.

BX will hold 6444 in hex format.

Select the correct answer.
What should you keep in mind when picking a topic for a research paper?
ОА.
choosing a general topic
OB.
choosing a topic that is relatively new
O C.
choosing a specific topic rather than a broad one
OD. choosing a topic based on the most number of sources you can find
Reset
Next

Answers

Answer: The answer is C

Explanation: When it comes to research papers your topic shouldnt be too broad. Your topic should be broad enough you can find a good amount of information but not too focused that you can't find any information.

Write a program that will create an array of random numbers and output the values. Then output the values in the array backwards. SPECIFICATIONS: File name: ArrayBackwards.java Your program must make use of at least one method other than main()to receive full credit (methods can have a return type of void). Suggestion: create and populate the array in the main() method. Make a method for Step 3 below and send in the array as a parameter. Make another method for Step 4 and send in the array as a parameter.

Answers

Answer:

The program is as follows:

import java.util.*;

public class Main{

public static void backward(int [] Rndarray, int lnt){

    System.out.print("Reversed: ");

    for(int itm = lnt-1;itm>=0;itm--){

        System.out.print(Rndarray[itm]+" ");     } }

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 int lnt = input.nextInt();

 Random rd = new Random();

 int [] Rndarray = new int[lnt];

 for (int itm = 0; itm < lnt; itm++) {

        Rndarray[itm] = rd.nextInt();

        System.out.print(Rndarray[itm]+" ");

     }

     System.out.println();

 backward(Rndarray,lnt); }}

Explanation:

This defines the backward() method

public static void backward(int [] Rndarray, int lnt){

This prints string "Reversed"

    System.out.print("Reversed: ");

This iterates through the array

    for(int itm = lnt-1;itm>=0;itm--){

Each element is then printed, backwards

        System.out.print(Rndarray[itm]+" ");     } }

The main begins here

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

This gets the array length

int  n = input.nextInt();

This creates a Random object

Random rd = new Random();

This declares the array

 int [] Rndarray = new int[lnt];

This iterates through the array for input

 for (int itm = 0; itm < lnt; itm++) {

This generates a random number for each array element

        Rndarray[itm] = rd.nextInt();

This prints the generates number

        System.out.print(Rndarray[itm]+" ");

     }

This prints a new line

     System.out.println();

This passes the array and the length to backward() method

 backward(Rndarray,lnt); }}

Why do organizations need to tailor project management concepts, such as those found in the PMBOK® Guide, to create their own methodologies?

Answers

Explanation:

Although each project is different and unique, according to the Method Statement of PMBoK, customising is required. Not that every procedure, tool, methodology, input, or output listed in the PMBoK Guide is mandated for every project. Scope, timeline, cost, materials, quality, and danger should all be considered while tailoring.

(2) What are the limitations of portable computer? ​

Answers

Answer:

Most portable computer are not upgradable and they have a lower specification than most desktop systems

Which of the following is NOT a computer hardware?
A) monitor
B) scanner
C) modem
D) Windows 10

Answers

Answer is d hope this helps

Sixteen stations, numbered 1 through 16, are contending for the use of a shared channel by using the adaptive tree walk protocol. If all the stations whose addresses are prime numbers suddenly become ready at once, how many bit slots are needed to resolve the contention

Answers

Answer:

11 bit slot will be needed

Explanation:

The number of prime numbers between 1 through 16

= 2, 3 , 5, 7, 11 and 13

hence we can say 6 stations are to use the shared channel

Given that all the stations are ready simultaneously

The number of bit slots that will be needed to handle the contention will be 11 bits :

slot 1 : 2, 3, 5 , 7, 11 , 13

slot 2 : 2,3, 5, 7

slot 3 : 2, 3

slot 4 : 2 .   slot 5 : 3 .  slot 6 : 5,7.   slot 7 : 5 .   slot 8 : 7.  slot 9: 11,13.  

slot 10 : 11.   slot 11 : 13

Which of the following is true? a. There are RFCs that describe challenge-response authentication techniques to use with email. b. Filtering for spam sometimes produces a false positive, in which legitimate email is identified as spam. c. Spam relies heavily on the absence of email authentication. d. All of the above.

Answers

The option that is true is option b. Filtering for spam sometimes produces a false positive, in which legitimate email is identified as spam.

How is spam filtration carried out?

The processing of email to organize it in accordance with predetermined criteria is known as email filtering. The word can allude to the use of human intelligence, although it most frequently describes how messages are processed automatically at SMTP servers, sometimes using anti-spam tactics.

Therefore, Email filtering operates as previously stated by scanning incoming messages for red flags that indicate spam or phishing content and then automatically transferring such messages to a different folder. Spam filters evaluate an incoming email using a variety of criteria.

Learn more about Filtering for spam from

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

How have technology and social media changed reading?
O A. Physical books can only be read on the web.
B. Now reading is a conversation of give and take.
O C. People no longer have to read anything at all.
D. Reading often takes much longer to undergo.

Answers

Answer:

B?

Explanation:

I'm super sorry if I get this wrong for you but after thinking so much I probably think it would be B

Answer:

the guy above is right it is B

Explanation:

because 2+2=4

What does the top-level domain in a URL indicate?
A. the organization or company that owns the website
B. the organization or company that operates the website
C. the protocol used to access the website D. the type of website the URL points to

Answers

Answer:

b i think

Explanation:

A top-level domain (TLD) is the last segment of the domain name. The TLD is the letters immediately following the final dot in an Internet address. A TLD identifies something about the website associated with it, such as its purpose, the organization that owns it or the geographical area where it originates.

Answer:

The answer is D. The type of website the URL points to.

Explanation:

I got it right on the Edmentum test.

Which of the following tools helps ensure your document will open in older versions of word

Answers

Answer:

Compatibility Check

Explanation:

Select File > Info.

In the Inspect Document section, select Check for Issues > Check Compatibility.

Click Select versions to show. A check mark that appears next to the name of the mode that the document is in.

what is the value of 2020/20×20​

Answers

Answer:.5.05

Explanation:...maths

Answer:

5.05

Explanation:

2020/400= 5.05

HOPE IT HELPED AND GOOD LUCK!!

What is the function of the NOS? Select all that apply.

•network management
•connects network nodes
•network security
•provides MACs
•gives access to privileges
•data protection

Answers

Answer:

.network management

Explanation:

pls need brainliest

Answer:

gives access privileges

network management

network security

data protection

Explanation:

If the user enters any operator symbol other than , -, *, or /, then an UnknownOperatorException is thrown and the user is allowed to reenter that line of input. Define the class UnknownOperatorException as a subclass of the Exception class. Your program should also handle NumberFormatException if the user enters non-numeric data for the operand.

Answers

Answer:

Explanation:

The following code is written in Java. It creates the UnknownOperatorException class and catches it if the user enters something other than the valid operators. If so it continues asking the user for a new input. Once a valid operator is entered, it exits the function and prints the operator.

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       char symbol = askForOperand();

       System.out.println("Operand: " + symbol);

   }

   public static char askForOperand() {

       Scanner in = new Scanner(System.in);

       try {

           System.out.println("Enter operator symbol: ");

           char symbol = in.nextLine().charAt(0);

           if ((symbol != '-') && (symbol != '*') && (symbol != '/')) {

               System.out.println(symbol);

               throw new UnknownOperatorException();

           } else {

               return symbol;

           }

       } catch (NumberFormatException | UnknownOperatorException e) {

           System.out.println("Not a valid operand");

           char symbol = askForOperand();

           return symbol;

       }

   }

}

class UnknownOperatorException extends Exception {

   public UnknownOperatorException() {

       System.out.println("Unknown Operator");

   }

}

4. Write a program to calculate square root and
cube root of an entered number .​

Answers

Answer:

DECLARE SUB SQUARE (N)

CLS

INPUT “ENTER ANY NUMBER”; N

CALL SQUARE(N)

END

SUB SQUARE (N)

S = N ^ 2

PRINT “SQUARE OF NUMBER “; S

END SUB

Given a member function named set_age() with a parameter named age in a class named Employee, what code would you use within the function to set the value of the corresponding data member if the data member has the same name as the parameter

Answers

Answer:

Explanation:

This would be considered a setter method. In most languages the parameter of the setter method is the same as the variable that we are passing the value to. Therefore, within the function you need to call the instance variable and make it equal to the parameter being passed. It seems that from the function name this is being written in python. Therefore, the following python code will show you an example of the Employee class and the set_age() method.

class Employee:

   age = 0

   

   def __init__(self):

       pass

   

   def set_age(self, age):

       self.age = age

As you can see in the above code the instance age variable is targeted using the self keyword in Python and is passed the parameter age to the instance variable.        

Select the correct term to complete the sentence.
The
file format is used for video files.

A. .pptx

B. .mp3

C. .jpeg

D. .mp4

Answers

Answer: D. mp4

its mp4 because its always on video files

Other Questions
Imagine that you are seeing a therapist for the first time for depression. When meeting with him/her, you are asked, Tell me about your early childhood experiences." What school of thought does this question reflect? 1-Humanistic 2-Psychoanalytic 3-Evolutionary4- Gestaldt ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,. Plz Answer this if you Answer this right you will get brainliest Don't Answer this question if you don't know you will be reported Javion drank 7/8 quart of juice in two days. He drank 1/4 quart of juice yesterday. How much did he drink today? Help me find the answer The school cafeteria is offering a choice of two side dishes at lunch today, either watermelon or french fries. The ratio of the number of orders of french fries to the total number of side dishes ordered is 9:14.Which of the following statements is correct about side dishes ordered?A There are 9 orders of french fries for every 14 orders of watermelon.B There are 5 orders of watermelon for every 9 orders of french fries.C There are 14 orders of french fries for every 9 orders of watermelon.D There are 5 orders of french fries for every 9 orders of watermelon. A chemist measures the flow of charged ions through a circuit. Which of these would increase the current? Select all that apply. Please look at the image A rectangular swimming pool has a length of 50 m, a width of 25 m, and a depth of 1.75 meters. What is the volume of water needed to fill the swimming pool?The volume of water needed to fill the swimming pool is m3. Richard drove to the east at 2 kilometers, then 1 kilometer south, and 1 kilometer west to reach home. When a lead acid car battery is recharged by the alternator, it acts essentially as an electrolytic cell in which solid lead(II) sulfate PbSO4 is reduced to lead at the cathode and oxidized to solid lead(II) oxide PbO at the anode.Suppose a current of 62.0 is fed into a car battery for 23.0 seconds. Calculate the mass of lead deposited on the cathode of the battery. Round your answer to 3 significant digits. Also, be sure your answer contains a unit symbol. How did Islam affect the development of African civilization? Select all that apply. African leaders applying the zakat tax to their people. Islam forced West African traders to convert to Islam. Muslims chosen as advisors by West African rulers received an education. Africans refused to use Arabic language and rejected Muslim business methods. Islam banned blends of Islam with traditional African beliefs. Find the area of the shape. Missie needs to buy a jug that can hold 3 dekaliters of water how much can it hold 20 300 30,000 3,000 $384 with a discount of 6.5% Re-write the quadratic function below in Standard Formy = 5(x - 2)(x - 5) do you think the vietnam war was avoidable, why or why not? 8. The mediator particle for gravitational force is on(1 Point)gluonvector bosonphotongravitone 12. .. ...the bad weather, they decided to have a picnic.(because / despite / whereas) i need help thanks u UwU