Im trying to get an exercise from a python 2 book to work in python 3.
1 def printMultiples(n):
2 i = 1
3 while i <= 6:
4 print(n*i, '/t',)
5 i = i + 1
6 print()
My problem is line 5. I understand that in python2 print is a statement and not a function. Just adding the parenthesis doesn't work. It just doesn't recognize the string, '/w'. I just cant figure out how to make this work in a function. I tried using str(n*i) to convert the integer to a string but that threw an error.
I know that you python guys know what I'm trying for and how to do it.
for i in range(1, 7):. No need to pre-initialize it to a start value, check it against an end value, and increment it manually (which gives you three separate places where a silly typo can lead to a hard-to-track-down bug, instead of just one).