Last active
October 4, 2017 09:55
-
-
Save DuffleOne/1cafe5a4e57ab349e7b91367f17aa8b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def makeInt(strVal): | |
try: | |
return int(strVal) | |
except ValueError: | |
return None | |
def main(): | |
print("Welcome, let's find out if you are due overtime for your work") | |
NoCount = 0 | |
UserName = "" | |
HoursWorked = None | |
while (UserName == ""): | |
UserName = str(input("Hello, can I have your name please?: ")) | |
if (UserName.upper() == "NO" or UserName.upper() == "N"): | |
NoCount += 1 | |
if (NoCount >= 3): | |
print("Fine. I'll just leave it.") | |
return; | |
else: | |
print("That's quite rude, I really do need your name though.") | |
UserName = "" | |
while (HoursWorked is None): | |
HoursWorked = makeInt(input("Please tell me how many hours you have worked: ")) | |
if (HoursWorked is None): | |
print("Huh, didn't quite catch that, can you enter a number?") | |
if (HoursWorked > 40): | |
print("%s, I am pleased to tell you that you are due overtime" % UserName) | |
else: | |
print("I'm sorry %s, You are not due overtime." % UserName) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment