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
This is running off a seperate class called userdetails
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
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() |