Первый раз python пользователь здесь. Я пытаюсь использовать какое-то время l oop, чтобы настроить тип инструмента поиска для школьных курсов. Я получу подсказки для вставки Subject и CatalogNbr; но вместо того, чтобы печатать название курса (например, «Введение в исследование» из первого блока), как мне нужно, он немедленно возвращается к запросу входных данных для Subject и CatalogNbr.
Из того, что я исследовал до сих пор Мне нужно включить операторы break и continue между циклами, но каждый раз, когда я пытаюсь включить те, у меня возникают синтаксические ошибки.
Любая помощь в том, как выполнить sh, будет принята с благодарностью
Query = 'Y'
while Query == 'Y':
Subject = input("Enter the Subject: \n> ")
CatalogNbr= input("Enter the CatalogNbr: \n> ")
if Subject == 'LIBS' and CatalogNbr == '150':
print(f"The title of {Subject,CatalogNbr} is Introduction to Research")
Query = input("\nWould you like to search for another title? (Y or N)\n> ")
elif Subject == 'SDEV' and CatalogNbr == '400':
print(f"The title of {Subject,CatalogNbr} is Secure Programming in the Cloud")
Query = input("\nWould you like to search for another title? (Y or N)\n> ")
elif Subject == 'PHIL' and CatalogNbr == '348':
print(f"The title of {Subject,CatalogNbr} is Religions of the East")
Query = input("\nWould you like to search for another title? (Y or N)\n> ")
elif Subject == 'BEHS' and CatalogNbr == '320':
print(f"The title of {Subject,CatalogNbr} is Disability Studies")
Query = input("\nWould you like to search for another title? (Y or N)\n> ")
elif Subject == 'PSYC' and CatalogNbr == '354':
print(f"The title of {Subject,CatalogNbr} is Cross-Cultural Psychology")
Query = input("\nWould you like to search for another title? (Y or N)\n> ")
elif Subject == 'SPCH' and CatalogNbr == '482':
print(f"The title of {Subject,CatalogNbr} is Intercultural Communication")
Query = input("\nWould you like to search for another title? (Y or N)\n> ")
elif Subject == 'WMST' and CatalogNbr == '200':
print(f"The title of {Subject,CatalogNbr} is Introduction to Womens Studies Women and Society")
Query = input("\nWould you like to search for another title? (Y or N)\n> ")
elif Subject == 'HYST' and CatalogNbr == '482':
print(f"The title of {Subject,CatalogNbr}is History of Japan to 1800")
Query = input("\nWould you like to search for another title? (Y or N)\n> ")
elif Subject == 'ASDT' and CatalogNbr == '370':
print(f"The title of {Subject,CatalogNbr} is Interpreting Contemporary China")
Query = input("\nWould you like to search for another title? (Y or N)\n> ")
elif Subject == 'JAPN' and CatalogNbr == '333':
print(f"The title of {Subject,CatalogNbr} is DJapanese Society and Culture")
Query = input("\nWould you like to search for another title? (Y or N)\n> ")
else:
print(f"I'm sorry {Subject,CatalogNbr} is not an avalible option.")
if Query == 'N':
print("Thank you for using the Catalog Search!")