Skip to content

Instantly share code, notes, and snippets.

@Pratik-Shukla-22
Created November 25, 2021 22:44
Show Gist options
  • Save Pratik-Shukla-22/6ae251e2ca588f766ec494ecd6ee86b9 to your computer and use it in GitHub Desktop.
Save Pratik-Shukla-22/6ae251e2ca588f766ec494ecd6ee86b9 to your computer and use it in GitHub Desktop.
#Python code for squirrels cigar party problem
def cigar_party(cigars, is_weekend):
#If it's a weekend
if(is_weekend):
#If number of cigars >=40
if(cigars>=40):
return True
#If it's not a weekend
else:
#If number of cigars are between 40 and 60 inclusive
if(cigars>=40 and cigars<=60):
return True
#If all the above cases are False
return False
#Function call
cigars = 20
is_weekend = False
answer = cigar_party(cigars, is_weekend)
print(f"With the given conditions the final answer is {answer}.")
###################### Output ######################
#With the given conditions the final answer is False.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment