Python Code - Program Problem Description You have two trees in your backyard th
ID: 3602874 • Letter: P
Question
Python Code - Program
Problem Description
You have two trees in your backyard that are in the process of losing their leaves. You want to create a program that will display a graph of how many leaves your trees have lost in one day. When trees lose leaves it is based on two factors: has the tree turned color yet and is it windy. If it is windy and the tree has turned color then your tree will lose 10 leaves every 6 hours. If it is windy and your tree has not turned color, your tree will lose 3 leaves every 6 hours. If it is not windy and your tree has turned color, your tree will loose 5 leaves every
6 hours. Finally if it is not windy and your tree has not turned color, your tree will lose 1 leaf per 6 hours.
Your program, therefore, needs to ask the user if it is windy and if your two trees have turned color. The output for the program will be the display of a graph.
Should look like this:
Explanation / Answer
windy = input("Is it windy today (yes/no):")
turn1 = input("Has your first tree turned color yet (yes/no):")
turn2 = input("Has your second tree turned color yet (yes/no):")
print("Tree1 | Tree2")
if windy == "yes":
for i in range(4):
if turn1 == "yes":
for j in range(10):
print("*",end='')
else:
for j in range(3):
print("*",end='')
print("|",end='')
if turn2 == "yes":
for j in range(10):
print("*",end='')
else:
for j in range(3):
print("*",end='')
print("")
else:
for i in range(4):
if turn1 == "no":
print("*|",end='')
else:
for j in range(5):
print("*",end='')
print("|",end='')
if turn2 == "no":
print("*",end='')
else:
for j in range(5):
print("*",end='')
print("")
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.