#
# print('Hello')
# print("Hello World")
# print("Hello","world")
#
# print("Hello World")
# print("Hello")
# print("World")
# print("'Hello'")
# print('"Hello World"')
# print('"!@#$%^&*()\'')
# print('"C:\\Download\\\'hello\'.py"')
# print('print("Hello\\nWorld")')
# x = input()
# x = int(x)
# x = int(input())
#
# print(x)
# print(type(x))
# int: integer
# x = input()
# y = input()
#
# x, y = input().split()
# x = int(x)
# y = int(y)
#
# print(x, y)
# c=input()
# print(c)
# n = input()
# n = int(n)
# print(n)
# f = input()
# f = float(f)
# print(f)
# a = input()
# b = input()
# a = int(a)
# b = int(b)
# print(a)
# print(b)
# a = input()
# b = input()
# print(b)
# print(a)
# f = input()
# f = float(f)
# print(f)
# print(f)
# print(f)
# a,b = input().split()
# a = int(a)
# b = int(b)
# print(a)
# print(b)
# c1,c2 = input().split()
# print(c2,c1)
# s = input()
# print(s,s,s)
# a,b = input().split(':')
# print(a,b,sep=':')
# y,m,d = input().split('.')
# print(d,m,y,sep='-')
# + - * /
# // %
# x, y = input().split()
# x = int(x)
# y = int(y)
#
# print(x+y)
# x = 10
# print('hello' + 'world' + str(x))
# ASCII: American Standard Code Inter Interchange
# x = input()
#
# print(x, type(x))
#
# x = ord(x)
#
# print(x, type(x))
#
# x += 1
#
# print(x, type(x))
#
# x = chr(x)
#
# print(x, type(x))
# a, b = input().split()
# a = int(a)
# b = int(b)
#
# print(a/b)
# print('%.2f %.2f' %(a/b, a*2/b))
# x = 'hello'
# print(x * 3)
# a = input()
# a = int(a)
# print(-a)
# a, b = input().split()
# a = int(a)
# b = int(b)
# c = a - b
# print(c)
# w, n = input().split()
# print(w*int(n))
# a, b = input().split()
# a = int(a)
# b = int(b)
# c = a**b
# print(c)
# a, b = input().split()
# a = int(a)
# b = int(b)
# print(a//b)
# a = input()
# a = float(a)
# print(format(a,".2f"))
# a, b = input().split()
# a = int(a)
# b = int(b)
# print(a+b)
# print(a-b)
# print(a*b)
# print(a//b)
# print(a%b)
# print(format(a/b,".2f"))
# a, b = input().split()
# a = int(a)
# b = int(b)
#
# print(a>b)
# >, >=, <, <=, ==, !=
# =: apply
import random
import random
point = 0
member = 25
Q = 0
class humanInfo:
def __init__(self):
self.name1 = None
self.name2 = None
self.name3 = None
self.letter = []
for i in range(26):
self.letter.append(chr(65 + i))
try:
x = random.randint(0, 25)
y = random.randint(0, 25)
z = random.randint(0, 25)
self.name1 = self.letter[x]
self.name2 = self.letter[y]
self.name3 = self.letter[z]
except:
print(x, y, z)
self.name = self.name1 + self.name2 + self.name3
self.age = random.randint(14, 16)
self.height = random.randint(155, 185)
self.weight = random.randint(40, 80)
self.gender = None
if random.randint(0, 2) == 0:
self.gender = "male"
else:
self.gender = "female"
def show(name, first, second, perfom):
print(name+': ' + str(first) + ', ' + str(second) + ', ' + str(perfom), end=' ')
class subject:
def __init__(self, name):
self.name = name
self.performance = random.randint(25, 50)
self.firstexam = random.randint(0, 25)
self.seconexam = random.randint(0, 25)
self.calculate = self.performance + self.firstexam + self.seconexam
def view(self):
show(self.name, self.firstexam, self.seconexam, self.performance)
class gradeInfo:
def __init__(self):
self.Korean = subject('Korean')
self.English = subject('English')
self.Math = subject('Math')
self.Science = subject('Science')
self.PE = subject('PE')
global point
self.total = (self.Korean.calculate + self.English.calculate + self.Math.calculate + self.Science.calculate + self.PE.calculate)
point += self.total #point: 총점수
class student:
def __init__(self):
self.privateData = humanInfo()
self.publicData = gradeInfo()
def viewer(self):
print(self.privateData.name1+self.privateData.name2+self.privateData.name3, end=': ')
print(self.privateData.age, end=' ')
print(self.privateData.gender, end=' ')
print(self.privateData.height, end=' ')
print(self.privateData.weight, end=' ')
self.publicData.Korean.view() # 각 과목의 firstexam, secondexam, performance 점수를 출력
self.publicData.English.view()
self.publicData.Math.view()
self.publicData.Science.view()
self.publicData.PE.view()
class new:
def __init__(self):
global member
self.member = member
global Q
self.Q = Q
def new_student(self):
k = student()
classroom.append([k, k.publicData.total, "0"])
for i in range(self.member):
classroom[i][2] = "0"
classroom[self.member-1][2] = "new"
for i in range(self.member - 1, 0, -1):
if classroom[i][1] > classroom[i - 1][1]:
l = classroom[i][1]
m = classroom[i][0]
o = classroom[i][2]
classroom[i][1] = classroom[i - 1][1]
classroom[i][0] = classroom[i - 1][0]
classroom[i][2] = classroom[i - 1][2]
classroom[i - 1][1] = l
classroom[i - 1][0] = m
classroom[i - 1][2] = o
self.Print()
def end(self):
while True:
n = int(input('new member is 1, close is 2'))
if n == 1:
self.member += n
break
self.Q = 1
self.new_student()
# 프로그램 종료
def Print(self):
for i in range(self.member):
if classroom[i][2] == "new":
print(classroom[i][0].viewer(), classroom[i][1], classroom[i][2])
else:
print(classroom[i][0].viewer(), classroom[i][1])
self.end()
# new Quest:
# 1. new member
# 2.
classroom = []
def room():
for i in range(25):
x = student()
classroom.append([x, x.publicData.total, "0"])
# bubble sort, insertion sort, quick sort, merge sort
for i in range(25):
for j in range(24):
if classroom[j][1] < classroom[j+1][1]:
x = classroom[j][1]
y = classroom[j][0]
classroom[j][1] = classroom[j+1][1]
classroom[j][0] = classroom[j+1][0]
classroom[j+1][1] = x
classroom[j+1][0] = y
p = new()
p.Print()
R = new()
if R.Q != 1:
room()
top of page
실제 작동 상태를 확인하려면 라이브 사이트로 이동하세요.
학생 정보 프로그램
학생 정보 프로그램
댓글 0개
좋아요
댓글(0)
bottom of page