Hello everyone,
so I just covered control flow in Python from the book I am using and will like to test my knowledge.
I gave myself this task: a manager has 20 days to complete a project. She needs to give the project owner the number of days it will require her to wrap up the project.
If she inputs
0 day then the task is done.
Anything between 1 to 19 days, the program tells her the number of days left.
20 days, she needs to get the ball rolling!
more than 20 days, she gets a warning
see my code below, kindly let me know how to improve it
project deadline countdown
project requires 20 days to completion
projectDays = 20
How many days do you need ?
print ("How many days do you need: ")
managerRequest = int(input())
execute this condition if the manager's requested days for completion is greater than 0 but less than 20
while projectDays > managerRequest and managerRequest > 0 :
print ("You have " + str(projectDays - managerRequest ) + ' day(s) left.' )
managerRequest =- 1
execute this condition if the manager's request is more than 20 days
if managerRequest > projectDays:
print ("You have only have " + str(projectDays) + ' days for execution.')
print ("You have " + str(managerRequest - projectDays) + " day(s) deficit")
execute this condition if the manager's request is exactly 20 days
elif managerRequest == 20:
print("kindly get to the job!")
execute this condition if the manager's request is 0 days i.e task completed!
elif managerRequest == 0:
print("Weldone on completing the project")
finally, I will appreciate more instructions that I can try coding based on Control flow, so that I test myself further.
much thanks
Top comments (0)