0

Times table

I mean what’s wrong this code. x = int(input()) print(x) y = x for i in range(1,12): print(x + y) Ex. It’s supposed to print ex.2*2 12 times

11th Aug 2022, 3:13 AM
Dan and Dave Deb
Dan and Dave Deb - avatar
4 Answers
+ 3
Favour Ibom I believe you want something more along the lines of this code. I don't believe you actually want to print 4 eleven times .. https://code.sololearn.com/c21P9bqdMRUy/?ref=app
11th Aug 2022, 3:26 AM
BroFar
BroFar - avatar
+ 2
It's going to print 4 eleven times cos you are adding 2+2 and not 2*2 inside the print function The maximum iteration count will also be 11 and not 12 because the range function uses the "left inclusive interval" mathematical set format to range it contents... This means (12-1) = 11
11th Aug 2022, 3:19 AM
Mirielle
Mirielle - avatar
+ 2
Favour Ibom we all began somewhere
11th Aug 2022, 4:01 AM
BroFar
BroFar - avatar
+ 1
BroFar I only learned beginners python.
11th Aug 2022, 3:48 AM
Dan and Dave Deb
Dan and Dave Deb - avatar