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
BlackZzzverrR [31]
3 years ago
11

Write a function "nonRepeatings" that takes a string "s3" and returns the non-repeating characters in this string. Sample Input

s3 = "aaazzzdcccrttt" Sample Output The non-repeating characters are; d ryou are suppose to use for loops to go throw and return a dictionary of non repeating letters.
Computers and Technology
1 answer:
Furkat [3]3 years ago
6 0

Answer:

def nonRepeatings(s3):

   non = []

   letter_dictionary = {}

   for l in s3:

       if l in letter_dictionary:

           letter_dictionary[l] += 1

       else:

           letter_dictionary[l] = 1

   for c in letter_dictionary:

       if letter_dictionary[c] == 1:

           non.append(c)

   

   return non

Explanation:

- Declare an empty list and a dictionary

- Initialize a for loop that iterates through the given string s3

Inside the loop:

- If a character in the string is in the dictionary, increment its count by 1. If not, add it to the dictionary

When the first loop is done, initialize another for loop that iterates through the dictionary.

- Inside the loop, check if any character has a value of 1, put it to the non.

- Finally, return the non

You might be interested in
Outline a scenario in which you might be acting ethically but might still want to remain anonymous while using the Internet. How
kompoz [17]

Answer:

I would like to stay anonymous while criticizing the current government. As there have been many cases when people who wrote against the government's decisions were caught by the police.

So I would prefer to stay anonymous while commenting on various government policies. My friends would know about it because I share my posts only with them.

The government can know about my identity by ordering the social networking site to reveal it.

8 0
3 years ago
Why is it important for element IDs to have meaningful names?
wlad13 [49]

Answer:

so a program can reference it; however, it does not necessarily need an event handler

Explanation:

8 0
3 years ago
What items should you evaluate when scouting the facilities at a shooting location?
Fiesta28 [93]

I would evaluate baggage and personal belongings, rooms or closets, people's clothing, and if anyone has a weapon.

3 0
3 years ago
According to Amdahl's Law, what is the speedup gain for an application that is 60% parallel and we run it on a machine with 4 pr
rodikova [14]

With four processing cores, we get a speedup of 1.82 times.

<h3>What is Amdahl's Law?</h3>

Amdahl's law exists as a formula that provides the theoretical speedup in latency of the implementation of a task at a fixed workload that can be expected of a system whose resources exist improved.

Amdahl's law exists that, in a program with parallel processing, a relatively few instructions that hold to be completed in sequence will have a limiting factor on program speedup such that adding more processors may not complete the program run faster.

Amdahl's law stands also known as Amdahl's argument. It is utilized to find the maximum expected progress to an overall system when only part of the system exists improved. It is often utilized in parallel computing to indicate the theoretical maximum speed up utilizing multiple processors.

Hence,  With four processing cores, we get a speedup of 1.82 times.

To learn more about Amdahl's Law refer to:

brainly.com/question/16857455

#SPJ4

6 0
1 year ago
Integers and booleans. Write a program RightTriangle that takes three int command-line arguments and determines whether they con
icang [17]

Answer:

<em>The programming language is not stated;</em>

<em>I'll answer using C++</em>

#include<iostream>

#include<cmath>

using namespace std;

int main()

{

int side1, side2, side3;

cout<<"Enter the three sides of the triangle: "<<endl;

cin>>side1>>side2>>side3;

if(side1<=0 || side2 <= 0 || side3 <= 0) {

 cout<<"Invalid Inputs";

}

else {

 if(abs(pow(side1,2) - (pow(side2,2) + pow(side3, 2)))<0.001) {

  cout<<"Right Angled";

 }

 else if(abs(pow(side2,2) - (pow(side1,2) + pow(side3, 2)))<0.001) {

  cout<<"Right Angled";

 }

 else if(abs(pow(side3,2) - (pow(side2,2) + pow(side1, 2)))<0.001) {

  cout<<"Right Angled";

 }

 else {

  cout<<"Not Right Angled";

 }

}

return 0;

}

Explanation:

The following line declares the three variables

int side1, side2, side3;

The next line prompts user for input of the three sides

cout<<"Enter the three sides of the triangle: "<<endl;

The next line gets user input

cin>>side1>>side2>>side3;

The following if condition checks if any of user input is negative or 0

<em> if(side1<=0 || side2 <= 0 || side3 <= 0) { </em>

<em>  cout<<"Invalid Inputs"; </em>

<em> } </em>

If otherwise

else {

The following if condition assumes that side1 is the largest and test using Pythagoras Theorem

<em>if(abs(pow(side1,2) - (pow(side2,2) + pow(side3, 2)))<0.001) { </em>

<em>   cout<<"Right Angled"; </em>

<em>  } </em>

The following if condition assumes that side2 is the largest and test using Pythagoras Theorem

<em>  else if(abs(pow(side2,2) - (pow(side1,2) + pow(side3, 2)))<0.001) { </em>

<em>   cout<<"Right Angled"; </em>

<em>  } </em>

The following if condition assumes that side3 is the largest and test using Pythagoras Theorem

<em>  else if(abs(pow(side3,2) - (pow(side2,2) + pow(side1, 2)))<0.001) { </em>

<em>   cout<<"Right Angled"; </em>

<em>  } </em>

If none of the above conditions is true, then the triangle is not a right angles triangle

<em>  else { </em>

<em>   cout<<"Not Right Angled"; </em>

<em>  } </em>

}

return 0;

Download cpp
4 0
3 years ago
Other questions:
  • Marie uses a browser to visit a blog. What is the unique identifier of the blog?
    13·2 answers
  • Fair use allows individuals to break copyright so long as they ________.
    15·1 answer
  • .____________ is a way to identify and differentiate goods andservices through use of a name or distinctive design element.
    10·1 answer
  • What is the decimal value of 00001111
    14·1 answer
  • To print a budget:________.
    9·1 answer
  • Write a chemical reaction to show that nitric acid contains nitrogen​
    15·1 answer
  • Can someone tell me how to fix the keyboard on ipad?- its in the middle of my screen andd i dont know how to do it
    13·1 answer
  • Repeated execution of a set of programming statements is called repetitive execution.
    7·1 answer
  • Ajdbksjdnksnsd helppp​
    11·1 answer
  • What does a blinking yelow light mean on a phillips sonicare toothbrush
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!