diff --git a/inputs_multiple2.txt b/inputs_multiple2.txt new file mode 100644 index 0000000..8ee75a6 --- /dev/null +++ b/inputs_multiple2.txt @@ -0,0 +1,3 @@ +0.5 -2.0 25 3 +0.4 -1.5 28 5 +0.2 -0.5 30 2 diff --git a/inputs_single1.txt b/inputs_single1.txt new file mode 100644 index 0000000..ac63bbc --- /dev/null +++ b/inputs_single1.txt @@ -0,0 +1,4 @@ +0.3 +-2.5 +26 +4 \ No newline at end of file diff --git a/version2_keyboard_input.py b/version2_keyboard_input.py new file mode 100644 index 0000000..72f6960 --- /dev/null +++ b/version2_keyboard_input.py @@ -0,0 +1,6 @@ +a = float(input("Enter coefficient a: ")) +b = float(input("Enter coefficient b: ")) +c = float(input("Enter coefficient c: ")) +t = float(input("Enter time t (hour/day): ")) +T = a * t**2 + b * t + c +print(f"Predicted temperature at t={t}: {T:.2f}°C") diff --git a/version3_file_input_single.py b/version3_file_input_single.py new file mode 100644 index 0000000..19d848b --- /dev/null +++ b/version3_file_input_single.py @@ -0,0 +1,10 @@ +with open("inputs_single1.txt", "r") as f: + lines = f.readlines() + +a = float(lines[0]) +b = float(lines[1]) +c = float(lines[2]) +t = float(lines[3]) + +T = a * t**2 + b * t + c +print(f"Predicted temperature at t={t}: {T:.2f}°C") diff --git a/version4_file_input_multiple.py b/version4_file_input_multiple.py new file mode 100644 index 0000000..1f907ee --- /dev/null +++ b/version4_file_input_multiple.py @@ -0,0 +1,5 @@ +with open("inputs_multiple2.txt", "r") as f: + for line in f: + a, b, c, t = map(float, line.strip().split()) + T = a * t**2 + b * t + c + print(f"a={a}, b={b}, c={c}, t={t} -> T={T:.2f}°C")