hello. i need help
I want to write a code that gives me 42 counterexamples ( it print when it is false). I wrote in a paper, |x|>22 or x=0 I want it to print 21,20,...,1,-1,-2...-21 it is in total 42 lists of a number when my program is false. and I don't know how to write it in python.
Steven Parker171,141 Points
You're getting a bit ahead of things here. Later courses will show you ways to do what you describe. But one simple one might look like this:
for x in range(22, -22, -1): # range can be wider, but this is enough if not (abs(x) > 22 or x == 0): # "not" is when the criteria are false print(x)
And there's 44 (not just 42) integer values where your criteria are false.