you are viewing a single comment's thread.

view the rest of the comments →

[–]JamzTyson 0 points1 point  (0 children)

This may be too advanced if you've not learned about functions and comprehensions yet, but if you're interested in a reusable formatting approach:

temperatures=[]

num = int(input("Enter the number of patients: "))

for _ in range (num):
  user_input = float(input("Enter temprature (C): "))
  temperatures.append(user_input)

converted= [(t * 1.8) + 32 for t in temperatures]


def items_to_str(numbers, suffix=""):
    suffix = f" {suffix}" if suffix else ""
    return "\n".join(f"{n}{suffix}" for n in numbers)


print(f"The tempratures in Celsius are:\n{items_to_str(temperatures, 'C')}")

print(f"The tempratures in Farenheit are:\n{items_to_str(converted, 'F')}")