Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5-Python-Hanging OutOnSouth Table Highest grade: 19 Problem Statement The summit of South Table has a pretty awesome view of the Golden Valley and Mines campus

image text in transcribed
image text in transcribed
image text in transcribed
5-Python-Hanging OutOnSouth Table Highest grade: 19 Problem Statement The summit of South Table has a pretty awesome view of the Golden Valley and Mines campus and is often used for events such as group hikes, hangouts, and programming problems. Unfortunately, new rules due to some unknown sickness (probably the flu) limit the number of people who can be on top of South Table at any one point in time. During a hiking event, people come and go from South Table, but it is pretty annoying to keep track of the number of people who are currently hiking. Furthermore, people often hike South Table in groups. If a group of people wish to hike South Table, but their addition would exceed the maximum allowed at the summit, they choose to go to Woody's and have pizza instead. Your task is to write a program that determines, given the sizes of the groups that attempted to hike South Table, how many groups were denied entrance to the hike (and went to Woody's instead). The first and second lines of input contain the maximum number of people N allowed on South Table and the number of South Table events E, respectively. Each following line of input contains an event where people attempt to start a hike or finish a hike. For the sample input/output given, N = 4 and E 3 are initially defined. Then, 3 people start the hike, so the current number on the mountain is 3. Then, 2 -- LII. -- AI Submit 5-Python-HangingOutOnSouth Table Highest grade: to start a hike or tinish a hike. For the sample input/output given, N = 4 and E = 3 are initially defined. Then, 3 people start the hike, so the current number on the mountain is 3. Then, 2 people try to start the hike; however, since 2 + 3 = 5 and 5 is above the maximum allowed, these two people go to Woody's instead. Then, 1 person finishes the hike, bringing the current number of people on South Table down to 2. The output is 1 since only 1 group (the second one) was denied entrance to the hike. Sample Input 1 4 3 start 3 start 2 finish 1 ET Sample Output 1 1 Submit 6-Python-Binary ToDecimal Highest grade Problem Statement The base 2, or binary numbering system, is used for data storage in all computing systems and electronic devices. Given a string of ones and zeroes, convert the binary string to an unsigned integer. If you are given a string that contains a digit NOT appropriate for a binary number (e.g., '2'), print out an error message for the user "ERROR: Input is not a binary number." (HINT: use the Python Membership check operator in ), In CSCI101 we learned one approach to convert binary to decimal: 1. Starting with the rightmost bit (i.e., least significant bit), multiply the digit by the value of the placeholder (base 2, exponent positional index) 2. Continue doing this and adding the results as you move right->left until you reach the leftmost bit (i.e., the most significant bit). NOTE: you are not allowed to use any built-in method or library to do the conversion. Your next 101 Python assignment will be to write a more complex number system converter, so use this Studio exercise as a warmup or a verification that the algorithm of your binary converter works! Sample Input 1 Submit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Question What is a Roth 401(k) feature?

Answered: 1 week ago