Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
User functions don't work:
#1
I've created a small program which runs like it should but I can't seperate the functions out and get them to work properly. Can the functions getpin(), get menuselection() be sorted out in a specific way so the program runs as normal.

This is running off a seperate class called userdetails


from Details import userdetails


def getpin():

    pin_no = ('1111', '2222', '3333')
    
    while True:

        pin_no = input("Input the no : ")

        if pin_no == '1111' or pin_no == '2222' or pin_no == '3333':
        
            
            print ("\n Hello and welcome to my program.  Please choose from one of the following options:")
        
            break
    
        else:
    
            print ("please try again ")
            
        
    
    
    Tom_Watts = userdetails ('Tom Watts \n' , '\nSidney Stringer School \n\n' 'GCSE English: Grade A \n'  'GCSE Maths:   Grade B \n' 'GCSE Physics: Grade A \n', 'GSA LTD', 'Barclays Bank', 'Good')

    Bill_Gates = userdetails ('Bill Gates \n ' '81 Oliver St \n ' 'dfdf', '6 gcses', 'CV6 7FR', 'aaa', 'good' )

    Steve_McQueen = userdetails ('Steve McQueen \n', '\nArizona High School \n\n' 'GCSE English: Grade A \n' 'GCSE Maths:   Grade A \n', 'GSA LTD', 'Lloyds Bank ', 'Average')


    dict = {
    
        '1111': Tom_Watts,
        '2222': Bill_Gates,
        '3333': Steve_McQueen, 
      
        }
    
 def getmenuselection():
    
    user =  input("\n\n 1. Userdetails \n 2. Education \n 3. Work History \n 4. Bank History \n" ' 5. Credit History \n\n  '  )

    a = '1'
    b = '2'
    c = '3'
    d = '4'
    e = '5' 

    
    if user == a:

        print (dict[pin_no].Userdetails)
    
    elif user == b:
    
        print (dict[pin_no].Education)
     
    elif user == c:
    
        print (dict[pin_no].Work_history)
    
    elif user == d:
    
        print (dict[pin_no].Bank_history)
    
    elif user == e:
    
        print (dict[pin_no].Credit_history) 


getpin()
getmenuselection()
Reply


Messages In This Thread
User functions don't work: - by Baldev10 - Aug-17-2020, 03:47 PM
RE: User functions don't work: - by ndc85430 - Aug-17-2020, 03:50 PM
RE: User functions don't work: - by Baldev10 - Aug-17-2020, 04:02 PM
RE: User functions don't work: - by ndc85430 - Aug-17-2020, 05:02 PM
RE: User functions don't work: - by Baldev10 - Aug-17-2020, 05:50 PM
RE: User functions don't work: - by deanhystad - Aug-17-2020, 09:15 PM
RE: User functions don't work: - by Baldev10 - Aug-18-2020, 04:22 PM
RE: User functions don't work: - by deanhystad - Aug-18-2020, 08:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Definitions in User-Created Functions and For Loops new_coder_231013 6 2,199 Dec-29-2021, 05:51 AM
Last Post: ndc85430
  Running scripts and location of saved interpreted user-defined classes and functions leodavinci1990 3 2,602 Aug-25-2020, 03:43 AM
Last Post: micseydel
  User defined functions inside other user defined functions WildP 1 1,987 Jan-29-2020, 04:57 PM
Last Post: Clunk_Head
  Parenthesis in User-Defined Functions giorgitsu 2 2,025 Aug-07-2019, 12:56 PM
Last Post: ThomasL
  Can't work out parameter format for LibVLC functions Domarius 10 6,093 Apr-30-2019, 10:54 PM
Last Post: Domarius
  Why won't this user created function work? Evyeniarocks 5 3,179 Mar-29-2018, 05:20 PM
Last Post: wavic
  I writte 5 functions (def) but on 6 don't work. Someone can help me? perrud 2 2,841 Feb-03-2018, 10:20 AM
Last Post: perrud

Forum Jump:

User Panel Messages

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