Skip to content
Open

V3 #2

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions inputs_single1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
0.3
-2.5
26
4
6 changes: 6 additions & 0 deletions version2_keyboard_input.py
Original file line number Diff line number Diff line change
@@ -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")
10 changes: 10 additions & 0 deletions version3_file_input_single.py
Original file line number Diff line number Diff line change
@@ -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")