Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок0
To find primes, why do i need to specify a range from 1 to the input number +1. Why +1
num = int(input("")) ListRange = list(range(1, num+1)) Why num+1, why is (1,num) not enough?
2 ответов
+ 1
With range(start, stop) the last number is not included, so if you want to include it you need to add one to it.
For example, range(2, 6) will include only 2, 3, 4, and 5.
0
thank you very much