Use if-else statements to find

4.20 LAB: Who is the best?

 

Learning Objectives

In this lab we will:

  • Use if-else statements to find the highest score amongst a group of 3 values
  • Use data structures to retrieve the name that corresponds to the highest score (potentially, in a data structure that makes this easier)

Main Idea

The problem presented in this lab is an active research area in Computer Science called differential privacy and secure (multi-party) computation. In this lab, we won’t be able to use a differentially private algorithm, so we will assume that the users stored their data secretly somewhere and cannot see each other’s values.

Three friends finished the test and want to secretly compare their test scores. They do not want to know each other’s exact score, but they do want to know who achieved the best results for this test.

Instructions

  1. Input the names and scores of the three friends one after another. (Check out the example input below)

  2. Your program should store both names and scores. Think about types to store and structures to store (You can do it in many ways, but we suggest tuples or named tuples or just separate variables.

  3. Compare the scores and find the highest.

    3.1. If there is one best score – print the name of the friend that achieved that score.

    3.2. If there are two friends with equal highest scores – print both names, separated by space, in the order of input.

    3.3. If all three friends achieved equal scores – print all three names, separated by space, in the order of input.

Examples

Input

Ann 10 Maria 9 Cindy 7

Output

Ann

Input

Ann 10 Maria 9 Cindy 10

Output

Ann Cindy

Input

Ann 10 Maria 10 Cindy 10

Output

Ann Maria Cindy

 
 
This is my code below

name1=input()  

m1=int(input())  

name2=input ()  

m2=int(input ())  

name3=input ()  

m3=int(input ())  
string = “”
if(m1>=m2) and (m1>=m3):

      large=m1;

elif(m2>=m3) and (m2>=m1):

       large=m2;        

else:

        large=m3;  

if large == m1:
    string = string +name1
if large == m2:
    string = string + name2
if large == m3:
    string = string + name3
print(string)

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more