- 博客(6)
- 收藏
- 关注
原创 Tic tac toe井字棋游戏python实现
游戏规则: 3x3的棋盘,2位玩家 比赛开始,第1位玩家可选择用X或者O 一行或者一列或者斜对角线三个相同点连成一线则获胜 平局可选择是否再玩一局 # Tic tac toe game def print_board(board): '''create the board''' print(board[7] + ' | ' + board[8] + ' | ' + board[9]) print('-------------') print(board[4]
2020-12-10 19:54:21
483
原创 Leetcode(Python3) 19. Remove Nth Node From End of List
The question is :Given the head of a linked list, remove the nth node from the end of the list and return its head. A follow-up question: Could you do this in one pass? Example input and output: Input: head = [1,2,3,4,5], n = 2 Output: [1,2,3,5] 题目要求删除链表倒
2020-12-10 06:15:40
283
原创 Pycharm中分段执行代码
Pycharm中如果只想执行一部分代码,可以在想要执行的代码段前加上#%%,然后菜单栏view里选中scientific mode。点击绿色小箭头即可。
2020-12-09 04:11:06
5642
原创 While True用法小例子
d = {'a': '111', 'b': '123'} count_user = 5 # max_input times is 5 while True: if count_user: name = input('请输入您的用户名:') if name in d: break else: count_user -= 1 print('您输入的用户名不存在,请重新输入')
2020-12-09 04:03:31
2019
原创 Python中countdown倒计时实现
在Python中实现倒计时功能可使用如下代码: # import the time module import time def countdown(t): '''define the countdown function''' while t: mins, secs = divmod(t, 60) timer = '{:02d}:{:02d}'.format(mins, secs) print(timer, end="\r")
2020-12-09 03:53:45
1762
1
原创 《大话数据结构》学习笔记--线性表
第三章 线性表什么是线性表线性表的顺序存储结构基本概念及特性顺序存储结构的存取操作顺序存储结构的插入和删除操作线性表的链式存储结构单链表静态链表循环链表双链表功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入 什么是线性表 线性表(L
2020-12-06 18:56:49
347
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅