This Python program receives three numbers from the user and sorts them in ascending order.
The key constraint: it does not use any conditional statements (if) or loops (for, while).
Instead, it relies on built-in functions and data structures.
# Read three numbers from user
x = float(input("Enter first number: "))
y = float(input("Enter second number: "))
z = float(input("Enter third number: "))
# Sort using built-in sorted() function
sorted_list = sorted([x, y, z])
# Display result
print("\n--- Sorted Numbers ---")
print(sorted_list)
Enter first number: 9
Enter second number: 3
Enter third number: 7
--- Sorted Numbers ---
[3.0, 7.0, 9.0]
- The program receives three floating-point numbers from the user
- It places them into a list and uses sorted() to sort the list
- No if statements or loops are used
- The result is printed as a list in ascending order