How do I do simple user input in python? [duplicate]

You can use the input() function to prompt the user for input, and float to convert the user input from a string to a float:

x1 = float(input("x1: "))
y1 = float(input("y1: "))
x2 = float(input("x2: "))
y2 = float(input("y2: "))

If you’re using python 2, use raw_input() instead.

Leave a Comment