How to noob edition

Hi people of the internet. I besiege you. I’m a complete noob but wait for it, I am hooked on coding. So far I have solved a few very basic arguments and I’ve finished some of the basic tutorials on html and CSS.

I came across a question a day or 2 ago and I’m looking for insight. Basically I’m trying to create a program that a user can input a time and see if a college is open or not but on top of that I want to extend the opening hours a few hours by the program asking if a college guard is there to open the gate after closing time. This actually wasn’t in the question other than guard is a Boolean either t or f doesn’t matter

I don’t really want the question answering but I would like to be encouragingly fireman’s lifted in the right direction. Now here is a version of the code in note form. Don’t laugh. I’ve been coding for less than a week and working in Python for 2 days lol

# can i convert this into : rather than decimal point?
visit = float(input("What time would you like to visit"))

time = (7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)
# can i use [:] to simplify time line?

a = visit
b = time[0]
c = time[-1]
x = (18, 19, 20)

guard = True
while a == x[0] or x[1] or x[2]:
    print("Guards on duty!")
# need to somehow separate guard duty from out of hours

if a < b or a > c:
 print("Out of hours")
 print("You're in")

Sorry it’s an incredibly long post!

Sorry the keep notes has auto turned what were comments to myself in the code into subheadings and now they are HUGE.

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

1 Like