Please help. I'm learning python and this challenge is driving me bananas as I can't get it right and don't know why. I suspect there is an issue with the step in the range but the book I'm learning from is no help. Please do not provide just the answer, please also tell me why/how? Thank you in advance.
The problem: If I have 2 values called num1 and num2 and num1 is always less than or equal to num2, then list all numbers between num1 and num2 in increments of 5 (as well as num 1 to start and num2 to end in that output).
Input: -15 10
Output I'm getting is: -15, 10, 5
Output should be: -15 -10 -5 0 5 10
currently using:
ig1 = int(input('Enter your first integer: '))
ig2 = int(input('Enter your second integer: '))
range_list = range(ig1, ig2, 5)
if ig1 <= ig2:
print(range_list)
else:
print("Second integer can't be less than the first.")