Today, we worked on three problems we solved with Python. Here they are...
#1. The Ladybug Problem:
We need 125 ladybugs to protect a tree from aphids.
We have 2600 ladybugs.
There are 20 trees.
Write a program to test if we have enough.
If there are, have it print, “There are enough ladybugs. We are safe.”
If there are not, have it print, “We need more ladybugs. The orchard is doomed!”
#2. Make a program that fills in an invite. The variables are…
Time=7:00
Place=”Portland Pie”
Who=”Zorro”
Have the programs print statement including these assigned variables so they can be easily changed.
“You are invited to a party…
#3. Use “if” to check if “today” is equal to “Saturday” or “Sunday”
If it is, then print the string, “Sleeping in”
If it is not, then print, “Time to get up”
Tomorrow we'll try to look at some of the solutions.
-M
#1. The Ladybug Problem:
We need 125 ladybugs to protect a tree from aphids.
We have 2600 ladybugs.
There are 20 trees.
Write a program to test if we have enough.
If there are, have it print, “There are enough ladybugs. We are safe.”
If there are not, have it print, “We need more ladybugs. The orchard is doomed!”
#2. Make a program that fills in an invite. The variables are…
Time=7:00
Place=”Portland Pie”
Who=”Zorro”
Have the programs print statement including these assigned variables so they can be easily changed.
“You are invited to a party…
#3. Use “if” to check if “today” is equal to “Saturday” or “Sunday”
If it is, then print the string, “Sleeping in”
If it is not, then print, “Time to get up”
Tomorrow we'll try to look at some of the solutions.
-M