The best way to do this would be to take each of your sections, and give them each a function of their own. Also, when itsit's possible, separate user input functions from purely logic to improve readability!
For example, it could start looking like this..:
def verify_pin(pin):
if pin == '1234':
return True:
else:
return False
def log_in():
tries = 0
while tries < 4:
pin = input('Please Enter YouYour 4 Digit Pin: ')
if verify_pin(pin):
print("Pin accepted!")
return True
else:
print("Invalid pin")
tries += 1
print("To many incorrect tries. Could not log in")
return False
def start_menu():
print("Welcome to the atm!")
if log_in():
# you will need to make this one yourself!
main_menu()
print("Exiting Program")
start_menu()
Whenever you can avoid nesting, you should. This makes it easier to read.
In this case you can clearly see logging in will open the main_menu (which you will have to write), and entering a correct pin is the only way to log in.