почему я не могу войти, если условия 3 и 4. 1 и 2 работают нормально для этого образца банковского кода - PullRequest
0 голосов
/ 13 июля 2020

, пожалуйста, может ли кто-нибудь проверить мой код и исправить меня, почему я не могу ввести оператор if, когда мне дали option input == 3 и option input == 4.

import sys,os,math
Account_balance= int(25000)
print('*** WELCOME TO SBI BANK NAKKALAGUTTA ***')
givenpin=input('Enter The 4 Digit  Pin Number ')
if givenpin =='0351':enter code here
    print('welcome MR.Anudeep RAO')
else:
    print('unauthorized access try again')
sys.exit()
print('your A/C number is: 10987xxxxxx')
print("### choose  an option  below ###")
print("""
1)        Balance
2)        Withdraw
3)        Deposit
4)        Quit
""")
option = int(input("Enter option:"))
if option == 1:
     print('your Account balance is' +' '+ str(int(Account_balance)) +'Rs/-')
elif option == 2:
      input_to_Withdraw = int(input("enter amount to withdraw "))

      if input_to_Withdraw > 25000:
          print("Insufficient Funds in Your A/C")
      elif input_to_Withdraw < 25000:
          present_balance = (Account_balance - input_to_Withdraw)
          print('collect cash and available balance is ' + str(int(present_balance)))

          if option == 3:
              Input_to_Deposit = int(input("enter amount to deposit into A/C "))
              print('deposited balance is:')
              print(Account_balance +Input_to_Deposit)

              if option == 4:
                  print('Transaction complete leave  bank safely  Bye:')

1 Ответ

0 голосов
/ 13 июля 2020

Ячейки if option == 3: и if option == 4: находятся глубоко внутри ящика elif option == 2:. Поскольку вы нигде не сбрасываете значение option, я предполагаю, что это ошибка.

Исправьте отступы в этих двух случаях, чтобы ваш код мог следовать этим путям. Они должны быть на том же уровне отступа, что и elif option == 2:.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...