def near_thousand(n):
return ((abs(1000 - n) <= 100) or (abs(2000 - n) <= 100))
print(near_thousand(1000))
print(near_thousand(900))
print(near_thousand(800))
print(near_thousand(2200))
Output:
True
True False False
def near_thousand(n):
return ((abs(1000 - n) <= 100) or (abs(2000 - n) <= 100))
print(near_thousand(1000))
print(near_thousand(900))
print(near_thousand(800))
print(near_thousand(2200))
Output:
True
True False False
write() and read() in file handling in python
program to print the documents (syntax, description etc.) of Python built-in function(s)
Append and read in file handling in python
Python program for Armstrong number
What is Break statement in python
Python Program to display the Fibonacci sequence up to n-th term
Write a program to add two numbers in python
String to list conversion in python
Increment and decrement operator in python
Python program which takes radius from user and print area