+ 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
9 Antworten
+ 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
+ 3
The error is in the num variable, not in the loop
+ 2
This is the updated code, thanks to Herr Rozwel for guiding me 💯💙
https://code.sololearn.com/c6JqJZpdKiG9/?ref=app
+ 2
Yes
+ 1
that was the one im looking for, thank you so much! Gotta review how you did it ❤️
+ 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()
0
Are going throughout space counting problem??
0
How do you face the problem?
- 2
Hi