Need Help Python loop Error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Need Help Python loop Error

So i want to make program that will let you input number of  Columns(from 1 to 9) and Number of rows(from 1 to 9), and it must have a trap where you can't input 10 above and it must print out of range, my code works but there's an error on line 16, and i dunno how to fix it. Can someone debug it for me? Thank you! ❤️❤️ Example: Rows: 5 Columns: 6 Output: 10 12 14 16 18 20 11 14 17 20 23 26 12 16 20 24 28 32 13 18 23 28 33 38 14 20 26 32 38 44 https://code.sololearn.com/cS6KetJ23Sn8/?ref=app

10th Dec 2021, 6:21 AM
Lia Costa ✨
Lia Costa ✨ - avatar
9 Answers
+ 7
I am not sure what exactly was the problem, but i changed the code a little bit and get no errors. https://code.sololearn.com/co0JaFrmM36U/?ref=app
10th Dec 2021, 6:47 AM
Herr Rozwel
Herr Rozwel - avatar
+ 3
The error is in the num variable, not in the loop
11th Dec 2021, 9:20 PM
CGO!
CGO! - avatar
+ 2
This is the updated code, thanks to Herr Rozwel for guiding me 💯💙 https://code.sololearn.com/c6JqJZpdKiG9/?ref=app
10th Dec 2021, 7:46 AM
Lia Costa ✨
Lia Costa ✨ - avatar
+ 2
Yes
11th Dec 2021, 9:30 PM
Luis Guerrero
+ 1
that was the one im looking for, thank you so much! Gotta review how you did it ❤️
10th Dec 2021, 7:23 AM
Lia Costa ✨
Lia Costa ✨ - avatar
+ 1
#Hi this Is your code: ini = 10 x = int(input("Rows: ")) y = int(input("Columns: ")) num = 10 counter = 2 #this condición first if x >= num or y >= num: print ("Out of range") else: for row in range(0, x): for col in range(0, y): print(num, end=" ") num = num + counter counter += 1 ini+=1 num = ini print()
12th Dec 2021, 3:11 AM
ruben
0
Are going throughout space counting problem??
11th Dec 2021, 5:51 PM
Shahrear Al Sakib
Shahrear Al Sakib - avatar
0
How do you face the problem?
11th Dec 2021, 5:59 PM
TAKI EDDINE ZERROUKI
- 2
Hi
11th Dec 2021, 2:49 PM
Rahat Khan 🇧🇩
Rahat Khan 🇧🇩 - avatar