Computer Science > QUESTIONS & ANSWERS > Conditions in Python Code HS | Questions and Answers 100% Pass Rate (All)

Conditions in Python Code HS | Questions and Answers 100% Pass Rate

Document Content and Description Below

Conditions in python code HS questions and answers 100% pass 4.1.4: Fix This Program ✔✔brought_food = True brought_drink = False print(brought_food) print(brought_drink) # These lines don't ... work! Fix them so that they do. print(type ("Did the person bring food? " + str(brought_food))) print(type ("Did the person bring a drink? " + str(brought_drink))) 4.1.5: Plants ✔✔needs_water = True needs_to_be_repotted = False print("Needs water: " + str(needs_water)) print (str(needs_to_be_repotted)) print(needs_water) 4.2.5: Fix This Program ✔✔can_juggle = True # The code below has problems. See if # you can fix them! if can_juggle: print("I can juggle!") else: print("I can't juggle.") 4.2.6: Is It Raining? ✔✔ 4.3.6: Old Enough to Vote? ✔✔your_age = int(input("How old are you?: ")) age_requirement= 18 can_vote = your_age >= age_requirement if can_vote: print("old enough to vote") else: print("not old enough to vote") 4.3.7: Positive, Zero, or Negetive ✔✔random_number = int(input("Enter a number: ")) if random_number < 0: print("That number is negative!") elif random_number > 0: print("That number is positive!") else: print("That number is zero!") 4.3.9: Table Reservation ✔✔reservation_name = "Shonda" name = input("Name: ") if name == reservation_name: print ("Right this way!") else: print ("Sorry, we don't have a reservation under that name.") 4.3.10: Transaction ✔✔# This program simulates a single transaction - # either a deposit or a withdrawal - at a bank. print(1000-50) print(1000+150) print("Invalid transaction") print("You cannot have a negative balance!") 4.4.4: Administrators, Teachers and students ✔✔role = input("Are you an administrator, teacher, or student? ") if role == "teacher" or role == "administrator": print ("Administrators and teachers get keys!") elif role == "student": print ("Students do not get keys!") else: print ("You can only be an administrator, a teacher, or a student!") 4.4.5: Presidential Eligibility ✔✔age = int(input("Age: ")) if age >= 35: print ("You are eligible to run for president.") else: print ("You are not eligible to run for president.") 4.4.6: Presidential Eligibility extended ✔✔age = int(input("Age: ")) citizen = input("Born in the U.S.? (Yes/No): ") years_resident = int(input("Years of Residency: ")) if age >= 35 and citizen == "Yes" and years_resident >= 14: print ("You are eligible to run for president!") else: print ("You are not eligible to run for president.") if age < 35: print("You are too young. You must be at least 35 years old.") if citizen == "No": print ("You must be born in the U.S. to run for president.") if years_resident < 14: print ("You have not been a resident for long enough.") 4.5.4: Correct Portion ✔✔# Amount of food and number of people tons_of_food = 0.07 num_people = 25 # Determine how much food each person gets tons_of_food_per_person =round(tons_of_food)/ round(num_people) print(tons_of_food_per_person) # Ask the user how much food they took tons_taken = float(input("How many tons of food did you take? ")) if round(tons_taken, 5) == round(tons_of_food_per_person, 5): print ("Good job, you took the right amount of food!") else: print ("You took the wrong amount of food [Show More]

Last updated: 8 months ago

Preview 1 out of 6 pages

Buy Now

Instant download

We Accept:

We Accept
document-preview

Buy this document to get the full access instantly

Instant Download Access after purchase

Buy Now

Instant download

We Accept:

We Accept

Also available in bundle (1)

Code HS Bundled Exams Questions and Answers with Complete Solutions

Code HS Bundled Exams Questions and Answers with Complete Solutions

By Nutmegs 2 years ago

$25

18  

Reviews( 0 )

$9.00

Buy Now

We Accept:

We Accept

Instant download

Can't find what you want? Try our AI powered Search

134
0

Document information


Connected school, study & course


About the document


Uploaded On

Apr 13, 2023

Number of pages

6

Written in

Seller


seller-icon
Nutmegs

Member since 4 years

620 Documents Sold

Reviews Received
77
14
8
2
21
Additional information

This document has been written for:

Uploaded

Apr 13, 2023

Downloads

 0

Views

 134


$9.00
What is Scholarfriends

In Scholarfriends, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.

We are here to help

We're available through e-mail, Twitter, Facebook, and live chat.
 FAQ
 Questions? Leave a message!

Follow us on
 Twitter

Copyright © Scholarfriends · High quality services·