[Python] I need help writing and finishing a program that describes a covid19 flowchart. I need 4 parts, specfically If I was in contact with someone else that was sick, taking the covid test, inputting the covid test (positive/negative), and attending school with risk of covid. Here's my code so far: while(True): # condition 1 val1 = input("\nAny COVID symptoms (a high body temperature, new continuous cough, lost taste or lost sense of smell)?\n").lower() if(val1=="yes"): # condition 2 val2 = input("\nTake a COVID test. What is the result?\n").lower() if(val2=="positive"): print("\nStay at home for 14 days\n") # continue is used to again ask the same questions continue elif(val2=="negative"): continue # condition 3 elif(val1=="no"): # if student is fine than just break the loop print("\nGo to school") break
[Python] I need help writing and finishing a program that describes a covid19 flowchart. I need 4 parts, specfically If I was in contact with someone else that was sick, taking the covid test, inputting the covid test (positive/negative), and attending school with risk of covid.
Here's my code so far:
while(True):
# condition 1
val1 = input("\nAny COVID symptoms (a high body temperature, new continuous cough, lost taste or lost sense of smell)?\n").lower()
if(val1=="yes"):
# condition 2
val2 = input("\nTake a COVID test. What is the result?\n").lower()
if(val2=="positive"):
print("\nStay at home for 14 days\n")
# continue is used to again ask the same questions
continue
elif(val2=="negative"):
continue
# condition 3
elif(val1=="no"):
# if student is fine than just break the loop
print("\nGo to school")
break
Step by step
Solved in 4 steps with 2 images
I need help making my python code to set up 4 variables like a flowchart for each option, using proper if/elif/else statements, and reformatting with f-strings to say how long should I stay home or test cases I should have.
4 variables: Had close contact with someone else sick, have a test, positive/negative, and should you attend school with sickness.
My code so far:
while(True):
print("\nWelcome to the COVID-19 Flowchart.")
print("Please answer the following questions to determine your course of action.")
val1 = input("\nDo you have any COVID symptoms (a high body temperature, new continuous cough, lost taste, or lost sense of smell)?\n").lower()
if val1 == "yes":
val2 = input("\nTake a COVID test. What is the result? (Positive/Negative)\n").lower()
if val2 == "positive":
print("\nYou tested positive for COVID-19. Please stay at home for 14 days.")
break
elif val2 == "negative":
continue
elif val1 == "no":
print("\nYou don't have any COVID symptoms. You can attend school.")
break
print("\nThank you for using the COVID-19 Flowchart. Stay safe!")