• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 6 pages
Exam (elaborations)

Conditions in python code HS questions and answers 100% pass

Document preview thumbnail
Preview 2 out of 6 pages

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


Document information

Uploaded on
March 10, 2023
Number of pages
6
Written in
2022/2023
Type
Exam (elaborations)
Contains
Questions & answers
$10.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
BrilliantScores
3.8
(786)
Sold
2919
Followers
2239
Items
16196
Last sold
1 week ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions

Whoops! We can’t load your doc right now. Try again or contact support.