Pyhton programming | Computer Science homework help

Pyhton programming

remise:

Adam is so good at playing arcade games that he will win at every game he plays. One fine day as he was walking on the street, he discovers an arcade store that pays real cash for every game that the player wins – however, the store will only pay out once per game. The store has some games for which they will pay winners, and each game has its own completion time and payout rate. Thrilled at the prospect of earning money for his talent, Adam walked into the store only to realize that the store closes in 2 hours (exactly 120 minutes). Knowing that he cannot play all the games in that time, he decides to pick the games that maximize his earnings 

Sample game board at the arcadeGAMECOMPLETION_TIME
(in minutes)PAYOUT_RATEPac-man90400Mortal Kombat1030Super Tetris25100Pump it Up1040Street Fighter II90450Speed Racer1040

An acceptable solution is the one where it still picks the best earnings even when the list of games or completion times or payout rates change. 

Question:
Write code in Java/Scala/Python to help Adam pick the sequence(s) of games that earn him the most money?.

Then, assume you have a variable list of games and their payout rates. What is the best way to pick the games that earn you the most?

Input Explanation

The first line of input is always an integer denoting many lines to read after the first line. In our sample test case, we have 6 in the first line and 6 lines after the first line, each having a game, completion_time and payout_rate. 

In each data line, the game, completion_time and payout_rate are separated by a ‘,'(comma).

The games board may change but the store still closes in 120 minutes. 

Input

6
Pac-man,80,400
Mortal Kombat,10,30
Super Tetris,25,100
Pump it Up,10,40
Street Fighter II,90,450
Speed Racer,10,40

Output Explanation

Print the game names that earn him the most into the standard output in alphabetical order

Output

Mortal Kombat
Pump it Up
Speed Racer
Street Fighter II

Python:

import sys

line = sys.stdin.readline()

print(line)

Calculate the price of your order

Select your paper details and see how much our professional writing services will cost.

We`ll send you the first draft for approval by at
Price: $36
  • Freebies
  • Format
  • Formatting (MLA, APA, Chicago, custom, etc.)
  • Title page & bibliography
  • 24/7 customer support
  • Amendments to your paper when they are needed
  • Chat with your writer
  • 275 word/double-spaced page
  • 12 point Arial/Times New Roman
  • Double, single, and custom spacing
  • We care about originality

    Our custom human-written papers from top essay writers are always free from plagiarism.

  • We protect your privacy

    Your data and payment info stay secured every time you get our help from an essay writer.

  • You control your money

    Your money is safe with us. If your plans change, you can get it sent back to your card.

How it works

  1. 1
    You give us the details
    Complete a brief order form to tell us what kind of paper you need.
  2. 2
    We find you a top writer
    One of the best experts in your discipline starts working on your essay.
  3. 3
    You get the paper done
    Enjoy writing that meets your demands and high academic standards!

Samples from our advanced writers

Check out some essay pieces from our best essay writers before your place an order. They will help you better understand what our service can do for you.

Get your own paper from top experts

Order now

Perks of our essay writing service

We offer more than just hand-crafted papers customized for you. Here are more of our greatest perks.

  • Swift delivery
    Our writing service can deliver your short and urgent papers in just 4 hours!
  • Professional touch
    We find you a pro writer who knows all the ins and outs of your subject.
  • Easy order placing/tracking
    Create a new order and check on its progress at any time in your dashboard.
  • Help with any kind of paper
    Need a PhD thesis, research project, or a two-page essay? For you, we can do it all.
  • Experts in 80+ subjects
    Our pro writers can help you with anything, from nursing to business studies.
  • Calculations and code
    We also do math, write code, and solve problems in 30+ STEM disciplines.

Frequently asked questions

Get instant answers to the questions that students ask most often.

See full FAQ
    See full FAQ

    Take your studies to the next level with our experienced specialists

    Chat
    Hello, my name is Derreck. Kindly drop your inquiry; I will get back to you shortly. (WhatsApp)+254 729 707 173