0% found this document useful (0 votes)
7 views3 pages

Temperature Monitoring System

Uploaded by

Dileep Nagendra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

Temperature Monitoring System

Uploaded by

Dileep Nagendra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

10/06/2024, 06:21 Untitled105 - Jupyter Notebook

localhost:8888/notebooks/Untitled105.ipynb?kernel_name=python3 1/3
10/06/2024, 06:21 Untitled105 - Jupyter Notebook

Real-Time Scenario: Temperature Monitoring System

Scenario:

You are developing a basic temperature monitoring system for a


weather station.

The system should continuously accept temperature readings


from sensors in real-time.

For each reading, determine if the temperature is above freezing


(positive), below freezing (negative), or at the freezing point
(zero).

The program should provide immediate feedback for each reading


and include an option to safely shut down the system.

Objective:

Create a Python program that simulates this temperature


monitoring system.

Requirements:

Continuously accept temperature readings.

Determine and display if the temperature is above freezing, below


freezing, or at freezing point.

Include an option to exit the loop gracefully (e.g., enter


"shutdown").

Enter temperature reading (type 'shutdown' to quit): 15

Temperature 15°C is above freezing.

Enter temperature reading (type 'shutdown' to quit): -3

Temperature -3°C is below freezing.

Enter temperature reading (type 'shutdown' to quit): 0

Temperature 0°C is at the freezing point.

Enter temperature reading (type 'shutdown' to quit): shutdown

localhost:8888/notebooks/Untitled105.ipynb?kernel_name=python3 2/3
10/06/2024, 06:21 Untitled105 - Jupyter Notebook

Shutting down the temperature monitoring system. Goodbye!

In [*]: while True:


temperature=input("Enter temperature reading (type 'shutdown' to quit):

if temperature=="shutdown":
print("Shutting down the temperature monitoring system. Goodbye!")
elif int(temperature)>0:
print(f"Temperature {temperature}°C is above freezing")
elif int(temperature)<0:
print(f"Temperature {temperature}°C is below freezing")
else:
print("Temperature 0°C is at the freezing point")

Enter temperature reading (type 'shutdown' to quit):15


Temperature 15°C is above freezing
Enter temperature reading (type 'shutdown' to quit):0
Temperature 0°C is at the freezing point
Enter temperature reading (type 'shutdown' to quit):-5
Temperature -5°C is below freezing
Enter temperature reading (type 'shutdown' to quit):shutdown
Shutting down the temperature monitoring system. Goodbye!

Enter temperature reading (type 'shutdown' to quit):

In [ ]: ​

localhost:8888/notebooks/Untitled105.ipynb?kernel_name=python3 3/3

You might also like