Write Python Code to solve the following questions. Store your result as a variable named 'answer'. Use 'print(answer)' to output your answer. Your answer should follow the previous pattern and format.
Read the following table regarding "Class size" and and then answer a question.
Teacher | Number of students\nMrs. Truman | 23\nMiss Urban | 26\nMrs. Woodworth | 27\nMs. Hershfeld | 28
Question: Some teachers compared how many students are in their classes. Which teacher has the most students? Choose from the the options: ['Mrs. Truman', 'Miss Urban', 'Mrs. Woodworth', 'Ms. Hershfeld']
Python code, return answer
teachers = {
'Mrs. Truman': 23,
'Miss Urban': 26,
'Mrs. Woodworth': 27,
'Ms. Hershfeld': 28
}
Find the teacher with the most students
most_students_teacher = max(teachers, key=teachers.get)
answer = most_students_teacher
print(answer)
Read the following table regarding "" and and then answer a question.
potatoes | $0.75 per kilogram\nzucchini | $0.60 per kilogram\nbeets | $0.29 per kilogram\ncucumbers | $0.96 per kilogram\ncarrots | $0.62 per kilogram
Question: Hanson went to the store and bought 2 kilograms of cucumbers. How much did he spend?
Python code, return answer
price_per_kilogram_cucumbers = 0.96
kilograms_bought = 2
answer = price_per_kilogram_cucumbers * kilograms_bought
print(answer)
Read the following table regarding "Children's weights (lbs)" and then answer a question.
Stem | Leaf \n1 | 1, 5\n2 | 0, 8, 9\n3 | 0, 0, 4, 9\n4 | 4, 7, 9\n5 | 1, 2, 3, 6, 9\n6 | 1, 5, 6
Question: Dr. Ramsey, a pediatrician, weighed all the children who recently visited his office. What is the weight of the lightest child? (unit: pounds)
Python code, return answer
The lightest child corresponds to the smallest value in the stem-and-leaf display.
lightest_child_weight = 11 # From the stem "1 | 1", the value is 11 lbs.
answer = lightest_child_weight
print(answer)
Read the following table regarding "" and then answer a question.
Option | Change in phone price\nAdd an upgrade | $60\nBuy a used phone | -$75
Question: Maddie is looking at the price of new cell phones online. Her favorite company, OrangeTech, has a special this weekend. Maddie can add an upgrade to a phone for an additional cost, or she can buy a used phone to get a discount. The change in price for each option is shown in the table. Which option results in a greater change in price? Choose from the the options: ['adding an upgrade', 'buying a used phone']
Python code, return answer
change_upgrade = 60
change_used_phone = -75
Compare the changes in price
if change_upgrade > abs(change_used_phone):
answer = 'adding an upgrade'
else:
answer = 'buying a used phone'
print(answer)
Read the following table regarding "Cans of food collected" and then answer a question.
Name | Number of cans of food\nEmmet | 680\nJustine | 350\nAntonio | 830\nKenji | 300\nHarper | 10
Question: As part of a food drive, five friends collected canned food. What fraction of the cans were collected by Emmet? Simplify your answer.
Python code, return answer
Total cans collected by all friends
total_cans = 680 + 350 + 830 + 300 + 10
Cans collected by Emmet
emmet_cans = 680
Calculate the fraction of cans collected by Emmet
fraction_emmet = emmet_cans / total_cans
Simplifying the fraction
from fractions import Fraction
simplified_fraction = Fraction(emmet_cans, total_cans).limit_denominator()
answer = simplified_fraction
print(answer)
{context}
Question: {question}