If you import this script as a module in another script, the __name__ is set to the name of the script/module. Python files can act as either reusable modules, or as standalone programs. if __name__ == “main”: is used to execute some code only if the file was run directly, and not imported.
range() takes mainly three arguments.
range(10) #it should return a lower and an upper bound value. As expected, the above cell returns a sequence of numbers starting with 0 and ending at 9. Next, let's look at the second way of working with the range function.
You can check if a number is present or not present in a Python range() object. To check if given number is in a range, use Python if statement with in keyword as shown below. number in range() expression returns a boolean value: True if number is present in the range(), False if number is not present in the range.
You should also use if 1 < number