Files
ba-degree/basic programming/1st task/9.py

17 lines
418 B
Python

# Q9
# Imports
import random
import math
# Print header with proper formatting
print(f"{'x':<10}{'y':<10}{'add':<10}{'subt':<10}"
f"{'mult':<10}{'div':<10}{'sqrt':<10}")
# Generate random numbers
x = random.randint(5,50)
y = random.randint(5,50)
# Print values with proper formatting
print(f"{x:<10}{y:<10}{x + y:<10}{x - y:<10}{x * y:<10}{x / y:<10.2f}"
f"{(x**2 + y**2)**0.5:<10.2f}")