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 a Python program to get the the volume of a sphere with radius 6
Python program to display the first and last colors from the following list
Python program to print formatted string
Python program to swap first and last element of a list
Python program for implementation of Bubble Sort
Python code to count the number of occurrences in list
Write Hello World Program in Python
Python Program to find the area of triangle
Python Program to generate a random number between 0 and 9
Write a Python program to test whether a number is within 100 of 1000 or 2000
write() and read() in file handling in python
Python Program to find the ASCII value of the given character