Upload files to "basic programming/1st task"

This commit is contained in:
2024-11-23 15:48:40 +02:00
parent b4ef6ebbac
commit a3e834c190
5 changed files with 90 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
# 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}")