In Python, Asap please!

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

In Python, Asap please!

Question-1:
You'll be given the weights of different passengers of a bus as input. The
passengers can normally sit in a single seat. But for passengers with
weight MORE THAN 100 requires two seats and those with weight MORE THAN 150
kilos won't get any seat in the bus. You need to print the number of seats
required for the passengers.
[Hint: You can use the split() function to convert the string into a list]
Sample Input1:
45, 67, 107, 151, 89, 121
Sample Output1:
7 seats
Explanation1:
Two persons weighing 107 and 121 kilos will require two seats each. The
person with weight 151 won't get a seat on the bus. And all others can sit
in a single seat. So 1+1+2+0+1+2 = 7 seats
Sample Input2:
74, 174, 47, 147, 65, 108, 109, 100
Sample Output2:
10 seats
Explanation2:
In this case, 1+0+1+2+1+2+2+1 = 10 seats
Transcribed Image Text:Question-1: You'll be given the weights of different passengers of a bus as input. The passengers can normally sit in a single seat. But for passengers with weight MORE THAN 100 requires two seats and those with weight MORE THAN 150 kilos won't get any seat in the bus. You need to print the number of seats required for the passengers. [Hint: You can use the split() function to convert the string into a list] Sample Input1: 45, 67, 107, 151, 89, 121 Sample Output1: 7 seats Explanation1: Two persons weighing 107 and 121 kilos will require two seats each. The person with weight 151 won't get a seat on the bus. And all others can sit in a single seat. So 1+1+2+0+1+2 = 7 seats Sample Input2: 74, 174, 47, 147, 65, 108, 109, 100 Sample Output2: 10 seats Explanation2: In this case, 1+0+1+2+1+2+2+1 = 10 seats
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education