import random import time import os # Clear Screen def cls(): os.system('cls') #clock Program def clock(): hour = 1 minute = 0 second = 0 timeday = 1 day = ('am') while True: print("the time is: %s" % hour + ":%s" % minute + ":%s" % second + "%s" % day) print(" H M S") print("H = Hour, M = Minute, S = Seconds") time.sleep(0.99) cls() second += 1 if second == 60: minute += 1 second = 0 if minute == 60: hour += 1 minute = 0 if hour == 13: timeday += 1 hour = 1 if timeday == 1: day = ('am') if timeday == 2: day = ('pm') if timeday == 3: timeday = 1 #Launch function if __name__=="__main__": clock() def get_reading(): for i in range(20): value = random.randint(0,60) print(value) if value <= 20: print("low power production, no circuits powered.") elif value <= 30: print("low-med power production, kitchen circuits powered.") elif value <= 40: print ("Med power production, downstairs circuits powered.") elif value <= 50: print("Med-high power production, downstairs & boiler circuits powered.") elif value <= 60: print("high power production, whole cicuit powered.") get_reading()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question