Python 은 간단 한 졸업생 정보 관리 시스템 의 예제 코드 를 실현 합 니 다.

앞 에 쓰기:
어젯밤 꿈 에서 데이터 관리 작업 을 회상 하 다.
자신의 주제 선정 을 실현 하 다
졸업생 정보 관리 시스템 은 학생 개인 정보의 기본 적 인 첨삭 과 검 사 를 실현 한다.
저 는 얼마 전에 배 운 목록 을 생각 했 습 니 다.이것 은 간단 합 니 다.학생 정보 목록 을 설계 한 다음 에 목록 에 모든 학생 들 의 상세 한 정 보 를 저장 하 는 목록 을 생각 한 다음 에 기본 적 인 첨삭 과 수정 을 실현 하 는 것 이 어렵 지 않 습 니 다!코드 바로 훑 기 시작!

코드 올 려!

def Menu():##     
  print('*'*22)
  print("*          : 1 *")
  print("*          : 2 *")
  print("*          : 3 *")
  print("*          : 4 *")
  print("*           0 *")
  print('*'*22)

def CheckIdisRight(StudentList,id):##          
  for i in range(0, len(StudentList)):
    if((id in StudentList[i])==True):
      return True
  return False

def PrintStudentList(StudentList):#        
  for i in range(0, len(StudentList)):
    print(StudentList[i])


def AddStudent(StudentList):##      
  number = int((input("     : ")))
  if(number<1000000000 and CheckIdisRight(StudentList,number)==False):##    
    print("      &     !     :")
    number = (input("     : "))
  name = input("       :")
  tell = input("       :")
  if(len(tell)!=11):
    print("          (11) : ")
    tell = input()
  college = input("         :")
  grade = input("       :")
  isjob = int(input("    ?:   1    0: "))
  if(isjob == 1):
    company = input("         :")
  else:
    company = 0
  arry = [number, name, tell, college, grade, isjob, company]
  StudentList.append(arry)##            
  PrintStudentList(StudentList)##        


def StudentPersonalMsg():##        
  print('*' * 22)
  print("*        : 1 *")
  print("*          : 2 *")
  print("*          : 3 *")
  print("*          : 4 *")
  print("*        : 0 *")
  print('*' * 22)


def ChangeStudent(StudentList):##        
  ##               
  def changename(StudentList, arry, i):#    
    print(arry)
    name = input("         :")
    StudentList[i][1] = name
    print("    :")
    PrintStudentList(StudentList)
  def changetell(StudentList, arry, i):#      
    print(arry)
    tell = input("           :")
    StudentList[i][2] = tell
    print("    :")
    PrintStudentList(StudentList)
  def changeisgob(StudentList, arry, i):#        
    print(arry)
    isgob = int(input("            :"))
    StudentList[i][5] = isgob
    print("    :")
    PrintStudentList(StudentList)
  def changcompany(StudentList, arry, i):#        
    print(arry)
    company = input("          :")
    StudentList[i][6] = company
    print("    :")
    PrintStudentList(StudentList)

  print("            :")
  id = int(input())
  i=1
  if((CheckIdisRight(StudentList,id))==False):##        
    print("     !")
  if(CheckIdisRight(StudentList,id)==True):
    while (i < len(StudentList)):#              
      if (StudentList[i][0] == id):
        StudentPersonalMsg()##          
        while (1):
          a = int(input("   : "))
          while (a):
            if (a == 1):
              ##    
              changename(StudentList, StudentList[i], i)
              break
            if (a == 2):
              ##      
              changetell(StudentList, StudentList[i], i)
              break
            if (a == 3):
              ##        
              changeisgob(StudentList, StudentList[i], i)
              break
            if (a == 4 and StudentList[i][5] == 1):
              ##      
              changcompany(StudentList, StudentList[i], i)
              break
            if (a == 4 and StudentList[i][5] == 0):
              print("      ,          !")
              break
          if (a == 0):
            ## 0         
            break
        ##           
        break
      i = i + 1


def DeleteStudent(StudentList):##      
  print("            :  0  !")
  id = int(input())
  i = 1
  if((CheckIdisRight(StudentList,id))==False):
    print("     !")
  if(CheckIdisRight(StudentList,id)==True):
    ##             
    while (i < len(StudentList)):
     if (StudentList[i][0] == id):
       del StudentList[i]
       print("    !")
       break
     if (id == 0):
       break
     i = i + 1
  PrintStudentList(StudentList)#        


def main():
  Menu()
  StudentInfo = ['  ', '  ', '  ', '  ', '  ', '    ', "    "]
  ##                 
  StudentList = [StudentInfo]
  while(1):
    a = int(input("   : "))
    while(a):

      if(a==1):
        PrintStudentList(StudentList)
        Menu()
        break
      if(a==2):
        AddStudent(StudentList)
        Menu()
        break
      if(a==3):
        ChangeStudent(StudentList)
        Menu()
        break
      if(a==4):
        DeleteStudent(StudentList)
        Menu()
        break
    if (a == 0):## 0    
      exit()
main()
테스트 효과 도 보기:
메 인 인터페이스

1.졸업 학생 정보 리스트 보기


2.졸업 학생 정보 추가

3.졸업 학생 정보 수정



4.졸업생 정보 삭제

대체적으로 기능 을 실 현 했 지만 전혀 생각 하지 못 했 습 니 다!!


잠시 말 문 이 막 힌 나:나*****(이것 이 바로 문 서 를 보지 않 은 결과 지!)
됐어,됐어,다시 써!
파 이 썬 이 간단 한 졸업생 정보 관리 시스템 을 실현 하 는 예제 코드 에 관 한 이 글 은 여기까지 소개 되 었 습 니 다.더 많은 파 이 썬 졸업생 정보 관리 시스템 내용 은 우리 의 이전 글 을 검색 하거나 아래 의 관련 글 을 계속 조회 하 시기 바 랍 니 다.앞으로 우 리 를 많이 지지 해 주시 기 바 랍 니 다!

좋은 웹페이지 즐겨찾기