On the 1st of september 2017 Tom’s grandmother gives him 150€, then, 15€ more the first day of each following month.
We would like to know until how many months Tom will have a sum exeeding 400€.
Write the corresponding program in Python.
1/ By using Python, write an algorithm which prints successively all the square numbers lower than 2000.
2/ Modify the previous algorithm so as it prints as well the number of square numbers belonging to this sequence.
S=150
N=0
while S<=400 :
S=S+15
N=N+1
print("Tom has to wait",N,"months")
1/ N=0
while N**2<=2000:
print(N**2)
N=N+1
2/ N=0
while N**2<=2000:
print(N**2)
N=N+1
print("there are",N,"numbers which square is lower than 2000")