当前位置:   article > 正文

python成绩管理系统界面-python实现简易版学生成绩管理系统

学生成绩管理系统python可视化

300来行python代码实现简易版学生成绩管理系统,供大家参考,具体内容如下

使用链表来实现

class Node(object):

def __init__(self, data, pointer):

self.data = data

self.next = pointer

# 创建单链表

class SingleLinkedList(object):

def __init__(self):

self.head = Node(None, None)

self.point = self.head

def append(self, data):

# 末尾追加节点

new_node = Node(data, None)

self.point.next = new_node

self.point = new_node

def insert(self, data, find):

# 插入数据(前向插入数据)

if not self.head.next:

print('链表为空')

return None

new_node = Node(data, None)

self.point = self.head

while self.point.next.data != find:

self.point = self.point.next

if self.point.next is None:

print('没有找到该元素')

return None

new_node.next = self.point.next

self.point.next = new_node

def delete(self, find):

# 删除节点

# 空链表

if not self.head.next:

print('链表为空')

return None

self.point = self.head

while self.point.next.data != find:

self.point = self.point.next

pointer = self.point.next

self.point.next = self.point.next.next

del pointer

def insert_after_head(self, data):

node = Node(data, None)

# bug 产生没写 if 返回

if not self.head.next:

self.head.next = node

return None

node.next = self.head.next

self.head.next = node

def reverse(self):

local_list = SingleLinkedList()

self.point = self.head

count = 0

while self.point.next:

count += 1

self.point = self.point.next

data = self.point.data

local_list.insert_after_head(data)

return local_list

def get_size(self):

count = 0

self.point = self.head

while self.point.next:

self.point = self.point.next

count += 1

return cou

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/594759
推荐阅读
相关标签
  

闽ICP备14008679号