Write a program that asks the user for two numbers and prints Close if the numbers are within .001 of each other and Not close otherwise.


num1 = float(input("Enter a number: "))
num2 = float(input("Enter another number: "))

if abs(num1 - num2) < 0.001:
print("Close")
else:
print("Not close")


This code first prompts the user for two numbers and stores them in variables num1 and num2. It then uses an if statement to check the absolute difference between the two numbers and compares it to 0.001. If the absolute difference is less than 0.001, it prints "Close", otherwise it prints "Not close".

You could name this code "number_closeness_checker" or something similar.

Enter a number: 1.234
Enter another number: 1.237
Not close

In this example, the user entered 0.0001 and 0.0002 as the two numbers. The numbers are close to each other because their absolute difference is less than 0.001.

Note that the output will vary depending on the two numbers the user inputs. If the absolute difference between the numbers is less than 0.001, the program will print "Close", otherwise it will print "Not close".