Python Programming for Beginners: A Kid's Guide to Coding Fundamentals by Patricia Foster
Author:Patricia Foster [Foster, Patricia]
Language: eng
Format: azw3, epub, pdf
ISBN: 9781646113897
Publisher: Rockridge Press
Published: 2020-10-19T16:00:00+00:00
Roller Coaster Challenge
A group of friends are headed to a theme park. However, some rides (like the Spinning Typhoon and the Rocket Blaster 5000) have a minimum height. Using an if-elif-else statement, letâs find the scariest roller coaster that the whole group can ride together.
To start our code, letâs put everyoneâs height (in inches) in a list. The order is completely random:
heights = [52, 54, 41, 62, 55, 49, 65]
If the shortest person in the group can ride a rollercoaster, then so can everyone else. Since weâve stored the heights in a list, we can use the min function to find the shortest height:
min_height = min(heights)
The min function returns the smallest number in the list. Then, we store the result in the âmin_heightâ variable.
Time to pick a roller coaster! The three options are:
1.Rumbling Log Ride: no height restrictions
2.Rocket Blaster 5000: 60" and over
3.Spinning Typhoon: 40â and over
When creating our conditional, order matters! Since the friends want to ride the scariest roller coaster possible, we want to start with the ride that has the tallest height requirement: the Rocket Blaster 5000.
if min_height >= 60:
print("You can ride the Rocket Blaster 5000!")
If the smallest friend is under 60", the group will have to look for other options. The next scariest roller coaster is the Spinning Typhoon:
elif min_height >= 40:
print("You can ride the Spinning Typhoon!")
If neither of those conditions are True, thereâs always the roller coaster with no height restriction: the Rumbling Log Ride. Since weâre not checking a condition, we can use an else instead of an elif:
else:
print("You can ride the Rumbling Log Ride!")
Our program is done! Make sure that all the lines of code inside your conditionals are indented, and then run your program.
CODE COMPLETE!
heights = [52, 54, 41, 62, 55, 49, 65]
min_height = min(heights)
Download
Python Programming for Beginners: A Kid's Guide to Coding Fundamentals by Patricia Foster.epub
Python Programming for Beginners: A Kid's Guide to Coding Fundamentals by Patricia Foster.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Hello! Python by Anthony Briggs(9911)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9794)
The Mikado Method by Ola Ellnestam Daniel Brolund(9775)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8292)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7775)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7758)
Grails in Action by Glen Smith Peter Ledbrook(7693)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Windows APT Warfare by Sheng-Hao Ma(6784)
Layered Design for Ruby on Rails Applications by Vladimir Dementyev(6511)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6409)
Blueprints Visual Scripting for Unreal Engine 5 - Third Edition by Marcos Romero & Brenden Sewell(6378)
Kotlin in Action by Dmitry Jemerov(5061)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4315)
Functional Programming in JavaScript by Mantyla Dan(4037)
Solidity Programming Essentials by Ritesh Modi(3976)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3762)
Unity 3D Game Development by Anthony Davis & Travis Baptiste & Russell Craig & Ryan Stunkel(3705)
The Ultimate iOS Interview Playbook by Avi Tsadok(3680)
