how do i loop back this data. this is part of a bigger code. after this statement ends i will also need to input another str to loop back into a bigger while loop.
specificReport = "yes"
while specificReport == "yes":
specificReport = str.lower(input("Do you want to look at the specific report (yes/no) : " ))
option2 = input("Which data are you looking for (1. Location Name, 2.Risk Type, 3. Risk Level , 4. Date & Time): ")
if int(option2) == 1:
locationValue = input("Enter the location you want to inspect: ")
print(df.loc[df['Location Name'] == locationValue])
elif int(option2) == 2:
riskTypeValue = str.lower(input("Enter the risk type you want to inspect: "))
print(df.loc[df['Risk Type'] == riskTypeValue])
elif int(option2) == 3:
riskLevelValue = str.lower(input("Enter the location you want to inspect: "))
print(df.loc[df['Risk Level'] == riskLevelValue])
elif int(option2) == 4:
dAndtValue = input("Enter the location you want to inspect: ")
print(df.loc[df['Date & Time'] == dAndtValue])
else:
print("You have keyed in an invalid option")
Aucun commentaire:
Enregistrer un commentaire