Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A simple error
#1
Hey can someone guide me to right direction as ive stumbled upon what it seems to be a simple error but cant understand what is wrong or missing something out
name = input("Name on your bank account? ")

def name ():
    
    if name=='Sweed':
        print('sw')
    elif name=='SEB':
        print('sb')
    else:
        print("wrong bank name")
with it or without programs runs fine its like its choces to ignore it
Reply
#2
You can not use name for variable and def

name = input("Name on your bank account? ")
 
def check_name ():
     
    if name=='Sweed':
        print('sw')
    elif name=='SEB':
        print('sb')
    else:
        print("wrong bank name")

check_name()
Reply
#3
damn i couldint wrap my head around of what was wrong thanks for pointing that out it works as intended now
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020