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
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F9962fe25-3b6f-4c65-87c9-c651a1c3379e%2Fb026e9f6-8b75-49fb-a114-8a7b6db43c87%2Fm0cwzhq_processed.png&w=3840&q=75)
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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images

Recommended textbooks for you

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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education