Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.02 KB | None | 0 0
  1. class Person:
  2.     def __init__(self,first_Name,last_Name,id,birth_date):
  3.         self.firstName = first_Name
  4.         self.lastName = last_Name
  5.         self.id = id
  6.         self.birth_date = birth_date
  7.  
  8.  
  9.  
  10. def main_project():
  11.     persons = []
  12.  
  13.     while True:
  14.         print("Hello! welcome to Bituah Leumi")
  15.         option = int(input("please choose: 1 to create person, 2 to create birth, 3 to serch, 4 to exit: "))
  16.         # לחכות לתשובה
  17.         # לפי התשובה להפנות לםונקציה ספציפית
  18.         if (option == 1):
  19.             new_person = add_person()
  20.             persons.append(new_person)
  21.             for i in persons:
  22.                 print (i.firstName),print(i.lastName),print (i.id)
  23.  
  24.         elif (option ==2):
  25.             new_birth = add_birth()
  26.         elif (option ==3):
  27.             new_serch = add_serch
  28.  
  29.         elif (option ==4):
  30.             exit()
  31.         else:
  32.             print("enter valid number:1-4")
  33.  
  34.  
  35. def add_person():
  36.     first_name = input("enter your first name: ")
  37.     while (not first_name.isalpha()):
  38.         first_name = input("wrong name! pleas enter your first name correct: ")
  39.     last_name = input("enter your last name: ")
  40.     id = list(input("enter your id number: "))
  41.     new_id =check_id(id)
  42.     kid= input ("press 'yes'-if do you have kids and 'no' if you dont have kids:")
  43.     if (kid == "yes"):
  44.         done=0
  45.         list_kids = []
  46.         while done!='done':
  47.             new_kid = add_person()
  48.             list_kids.append(new_kid)
  49.             done=input('add kid/done')
  50.         for i in list_kids:
  51.             print(i.firstName), print(i.lastName), print(i.id)
  52.     else:
  53.         list_kids='none'
  54.  
  55.     # persons.append(new_kid)
  56.  
  57.    
  58.     p=Person(first_name,last_name,id,list_kids)
  59.     return p
  60.  
  61.  
  62. def add_birth():
  63.   pass
  64.  
  65. def add_serch():
  66.   pass
  67.  
  68. def check_id(id):
  69.     while len(id) < 9:
  70.         id.insert(0, 0)
  71.     return (id)
  72.  
  73. def ege(self):
  74.     age = 2019 - int(self.birth_date)
  75.     return (age)
  76.  
  77.  
  78.  
  79. main_project()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement