Question: Kindly do it using Python Class Task A new movie has just been released Interstellar! There are a lot of people at the cinema box

 Kindly do it using Python Class Task A new movie has

Kindly do it using Python

Class Task A new movie has just been released "Interstellar"! There are a lot of people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 dollar bill. An "Interstellar" ticket costs 25 dollars. Ali is currently working as a clerk. He wants to sell a ticket to every single person in this line. Can Ali sell a ticket to every person and give change if he initially has no money and sells the tickets strictly in the order people queue? Print YES, if Ali can sell a ticket to every person and give change with the bills he has at hand at that moment. Otherwise print NO. When run on following sequence: [ 25, 25, 50 ): Output is YES . When run on following sequence: [ 25, 100 ]: Output is NO When run on following sequence: [ 25, 25, 50, 50, 100): Output is NO (As Ali will not have the right bills to give 75 dollars of change (you can't make two bills of 25 from one of 50)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!