def buyingApp():
appDownPick=1
while (appDownPick !=0):
appDownPick = int(input("\nWhich application do you want to download?\nPlease specify the index of the application\nIf you don't want to download, please enter 0.: "))
if (appDownPick == 1):
appDownCon = input("You've chosen to download 'PUBG Mobile'. The price of the application is US$5. Do you want to download this application? (Y/N): ")
if (appDownCon == Y):
if (getBalanceasTotal (ledge)<0): #When balance is not enough, it would not work.
print ("Insufficient funds")
print ("Please restart and try again")
break
elif (getBalanceasTotal(ledge)>0): #When balance is enough to purchase, it would download and saved in the document.
spendBalance (0,5.0,"You have downloaded PUBG Mobile for US$5.")
print ("You have downloaded PUBG Mobile.")
break
elif (appDownCon == N):
break
Я работаю над этим кодом, который просит пользователя выбрать, будет ли он загружать приложение в конце или нет, и должен ли он работать.
Однако, когда мой код запущен, он просто продолжает спрашивать appDownPick и appDownCon, когда он должен приступить к покупке связанного кода.
Какую часть я должен исправить, чтобы этот код работал?
+) Это выполняется с помощью кода ниже
option = 1 #Declare option as 1 so that while loop can work, and until the user puts 0, this, option command will keep looping.
while (option!=0):
option = int(input("Options:\n1. Search by Category\n2. Search by Name (This option requires to type the exact name of the application)\n3. Download the application\nPlease enter 0 to quit App Store."))
if (option == 1):
categorize()
elif (option == 2):
search()
elif (option == 3):
buyingApp()
else:
break