
Patrick B. answered 03/07/21
Math and computer tutor/teacher
# Problem 1
for iLoop in range(1,101):
if iLoop%2==0: print(str(iLoop) + " is even")
if iLoop%2==1: print(str(iLoop) + " is odd")
#-------------------------------------------------------
# Problem 2
x=25
for iLoop in range(100,-1,-1):
print(iLoop)
if ((iLoop%25)==0) and (iLoop<100) and (iLoop>0):
print(str(x) + "% of the countdown is complete ")
x=int(x)+25
print("Countdown is complete")
#-----------------------------------------------------------------
#Problem 3
def CalculateSeason( xTemp):
strSeasonReturn = "????"
if (int(xTemp)>=61) and (int(xTemp)<=85):
strSeasonReturn=" Spring "
elif (int(xTemp)>85):
strSeasonReturn=" Summer "
elif (int(xTemp)>=40) and (int(xTemp)<=60):
strSeasonReturn=" Fall "
else:
strSeasonReturn=" Winter "
return strSeasonReturn
#---------------------------
N=10
temperatures = []
for iLoop in range(int(N)):
xTemp = input("Please input temperature # " + str(iLoop+1) + " of " + str(N) + ":>")
temperatures.append(xTemp)
for iLoop in range(int(N)):
curTemp = temperatures[iLoop]
strSeason = CalculateSeason(curTemp)
print ("temperature " + str(curTemp) + " is " + strSeason)