Please i need solutions to these questions

1)In this task, you will implement a check using the if… else structure you learned earlier.You are required to create a program that uses this conditional.

At your school, the front gate is locked at night for safety. You often need to study late on campus. There is sometimes a night guard on duty who can let you in. You want to be able to check if you can access the school campus at a particular time.

The current hour of the day is given in the range 0, 1, 2 … 23 and the guard’s presence is indicated by with a True/False boolean.

If the hour is from 7 to 17, you do not need the guard to be there as the gate is open
If the hour is before 7 or after 17, the guard must be there to let you in
Using predefined variables for the hour of the day and whether the guard is present or not, write an if statement to print out whether you can get in.

Example start:
hour = 4
guard = True

Example output:
‘You’re in!’

Make use of the if statement structure to implement the program.

If you’re having trouble with an exercise, the best way to get feedback is to use the CLI tool to submit the code you have and then to “Request mentoring”. That will enable a mentor to see (1) your code and (2) the exact error messages.

Your post does not provide any details about what you are having trouble with.

It seems the problem you’re describing is not an Exercism exercise. Are you asking about a homework assignment?

1 Like