Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
thumb_up100%
Define function print_popcorn_time() with parameter bag_ounces. If bag_ounces is less than 3, print "Too small". If greater than 10, print "Too large". Otherwise, compute and print 6 * bag_ounces followed by "seconds". End with a newline. Remember that print() automatically adds a newline.
Sample output with input: 7
42 seconds
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Python question please include all steps and screenshot of code. Also please provide a docstring, and comments through the code, and test the given examples below. Thanks. Write a function crypto() that takes as an input a string s and returns an encryptedstring where encryption proceeds as follows: split the text up into blocks of two letterseach and swap each pair of letters (where spaces/punctuation, etc. is treated like letters).If the input string>>> crypto('Secret Message')'eSrcteM seaseg'>>> crypto('Secret Messages')'eSrcteM seasegs'arrow_forwardI need help creating a python code described belowarrow_forwardApply your knowledge about arrays and functions and write a program, which takes a positive integer N from user, and prints the multiplication table of the size N by N. For Example, if the user enters 10 then your program should display the following table. Note: your program should have a function naming "Multiplication" which should take size N as input argument. Output should be in this format. 1 2 3 4 5 6 7 8 9 10 71 81 91 10 I 1 I 21 31 4 1 4 51 5 61 6 12 7 8 16 24 1 123 2 3 4 5 6 7 8 9 8 10 12 14 16 18 12 15 18 21 24 27 16 20 32 36 20 25 30 35 40 45 18 24 30 36 42 48 54 35 42 49 56 63 70 32 40 48 56 64 72 80 36 45 54 63 72 81 90 20 30 40 50 60 70 80 90 100 2 3 6 6 9 8 12 10 24 10 15 14 21 28 9 18 27 24 28 10 20 30 40 50 60arrow_forward
- Please answer in python with showing the codesarrow_forwardMy Birthday Function Write a well-documented Python program, hmwk4Q4.py, that simulates a single trial of a person walking into a room on N people and determining if their birthday matches any of the other N people in the room. Design a function myBirthday (N) that returns True if a match is found, or False if no match is found. Import the python random number module into your program. On a single trial, with a user input 200 people, you may not find someone with your birthday. If you manually rerun the simulation ten times, your code, however, should see that approximately four (4.22 exactly) times there is a match to your birthday.arrow_forwardDefine function print popcorn_time() with parameter bag ounces. If bag ounces is less than 3, print "Too small". If greater than 10, print "Too large". Otherwise, compute and print 6* bag ounces followed by 'seconds". End with a newline. Sample output with input: 7 42 seconds 1 2 Your solution goes here *** 3 4 user_ounces int(input()) 5 print popcorn_time(user_ounces) Iarrow_forward
- Add a function to get the CPI values from the user and validate that they are greater than 0. 1. Declare and implement a void function called getCPIValues that takes two float reference parameters for the old_cpi and new_cpi. 2. Move the code that reads in the old_cpi and new_cpi into this function. 3. Add a do-while loop that validates the input, making sure that the old_cpi and new_cpi are valid values. + if there is an input error, print "Error: CPI values must be greater than 0." and try to get data again. 4. Replace the code that was moved with a call to this new function. - Add an array to accumulate the computed inflation rates 1. Declare a constant called MAX_RATES and set it to 20. 2. Declare an array of double values having size MAX_RATES that will be used to accumulate the computed inflation rates. 3. Add code to main that inserts the computed inflation rate into the next position in the array. 4. Be careful to make sure the program does not overflow the array. - Add a…arrow_forward//Write a function that loops through and console.log's the numbers from 1 to 100, except multiples of three, log (without quotes) "VERY GOOD" instead of the number, for the multiples of five, log (without quotes) "SUPER AWESOME". For numbers which are multiples of both three and five, log (without quotes) "VERY GOOD SUPER AWESOME" Console log out: 12VERY GOOD4SUPER AWESOMEVERY GOOD78VERY GOODSUPER AWESOME11VERY GOOD1314VERY GOOD SUPER AWESOME1617VERY GOOD19SUPER AWESOMEVERY GOOD2223VERY GOODSUPER AWESOME26VERY GOOD2829VERY GOOD SUPER AWESOMEarrow_forwardDescription Xiao Zhang is often distressed because there are too many things to arrange. Now he has n tasks at hand, and each task has a starting times, and an ending time e;. To complete a task, he must do it from the starting time to the ending time, and Xiao Zhang can only perform one task at the same time. Xiao Zhang wants to know how many tasks he can accomplish at most. Input The first line is an integer n (1sns300000), indicating the number of tasks Xiao Zhang has at hand. In the next n lines, each line contains two integers s₁, e¡ (1≤s;arrow_forwardCan you give me two ways to do itarrow_forwardFlowchart, create. Writing Functions that Require a Single Parameter in Python def sums(n): s = 0 for i in range(1, n + 1): s += i print("Sum is:", s) def products(n): p = 1 for i in range(1, n + 1): p *= i print("Product is:", p) numberString = input("Enter a positive integer or 0 to quit: ") number = int(numberString) while number != 0: sums(number) products(number) numberString = input("Enter a positive integer or 0 to quit: ") number = int(numberString)arrow_forwardarrow_back_iosarrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
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