Hey/Aweh/How are you all?
I’m writing this is in hopes to get a response soon. I will add some images…
I’m really batteling with the formats in Python. For example : nested if statements or for statements.
#prints out first 5 multiples of numbers 1 - 5.
for x in range(1, 6):
for y in range(1, 6):
print(’%d*%d=%d’ % (x,y,xy))
=====================================Inui understand everything up till line 3. Where does %d come from, also why is there another % in the middle? Lastly I understand xy but why (x,y,x*y)?
Now example 2
see picture. I have to use nested for loops to create a table that reassembles this one.
After. hOURS of playing around I finally got to my code…
for I in range(1, 10):
for y in range(i + 1):
print(i*y, end= “\t”)
This works almost perfect except that it displays a " 0 " in front of each row, which I don’t want !
I hope someone can assist and help me better understand.