Advertisement

Code HS Intro to Computer Science Ex 4.5.4: Correct Portion (Codes in Description)

Code HS Intro to Computer Science Ex 4.5.4: Correct Portion (Codes in Description) Since I cant use any kind of special character in the Description There are some typos in the codes so watch the video for Complete codes.
Code HS Intro to Computer Science Ex 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 = tons_of_food / 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!"
Thanks and Peace
Tags:
Code HS, Code HS Tracy Python, Code HS Answers, COde HS Tracy Python Answers,

Code HS Intro to Computer Science Ex 4.5.4:Correct Portion Code HS,Code HS Tracy Python,Code HS Answers,COde HS Tracy Python Answers,

Yorum Gönder

0 Yorumlar