+ 1
Why is this wrong
https://sololearn.com/compiler-playground/cL5T829jrRbm/?ref=app
8 Respostas
+ 7
There are two errors in your code.
1. Indentation of line 2 is wrong;
2. "If" is not a valid keyword.
+ 6
Hint: Python is case sensitive.
+ 6
Ahmed Fouad Eid El-Dmrdash ,
additional to the suggestions from per bratthammar:
# if we just wanted to skip *one* number we can use:
for X in range(1,21):
if X != 13:
print(X)
# if we wanted to skip *several numbers*, we can use:
skip = [13, 15, 17]
for X in range(1,21):
if X not in skip:
print(X)
+ 3
# Hi Ahmed Fouad Eid El-Dmrdash,
# In your case, it's better to use 'continue' instead of 'pass'.
# If you want to skip multiple values in a range before printing them:
rng = range(1, 18)
skip = {5, 7, 8, 9, 11, 12, 13}
# Convert the range to a set and subtract the 'skip' set, then sort and
# print each value on a new line.
print(*sorted(set(rng) - skip), sep='\n')
+ 2
Nikky faith Web If you want to ask a question, please start your own thread by going to Create -> DISCUSS and clicking on the green plus sign.
0
A range isn't an integer
0
Ahmed Fouad Eid El-Dmrdash change X to x
0
How can I create calculator using HTML