
Python
人生苦短,我用python
Vera0831
一枚努力变强的小垃圾
展开
-
Leetcode Reverse Integer overflow problem
Leetcode 刷题:一个easy级别的题目。Note: Assume we are dealing with an environment that could only store integers within the 32-bit signed integer range: [−231, 231 − 1]. For this problem, assume that your function returns 0 when the reversed integer overflows.原创 2021-01-12 00:40:21 · 292 阅读 · 0 评论 -
简便算法计算一个数乘以11的结果:Multiply_by_11
在计算一个数乘以11时我们有简便算法:There is a simple trick to multiplying any two-digit number by 11 in your head:Add the two digits togetherPlace the sum between the two digits!Note if the total goes over, carry the sum on to the next digit比如:23 * 11Add togethe原创 2020-11-30 01:24:01 · 453 阅读 · 1 评论 -
python编程基础练习——实现猜单词游戏
猜单词游戏就是计算机随机产生一个单词,打乱字母顺序,供玩家去猜。猜单词游戏的python实现如下:## 猜单词游戏import randomwords = ('python','jumble','difficult','iphone','excellent','outstanding','outside','elegent')print(""" 欢迎参加猜单词游戏 把字母组合成一个正确的单词""" )iscontinue = "y"while iscontinue=="y" or原创 2020-11-13 16:26:57 · 2132 阅读 · 2 评论 -
python 图形界面设计
图形界面设计简单练习:创建一个列表框选择内容添加到另一个列表的GUI程序。from tkinter import *root = Tk()def button1(): for i in lstb0.curselection(): ## 遍历选中项 lstb1.insert(0,lstb0.get(i)) ## 添加到右边列表框def button2(): for j in lstb1.curselection(): lstb1.delete(j) # 从右边列表框中删除##原创 2020-11-13 15:41:02 · 529 阅读 · 0 评论 -
python 基础练习——简单
Problem 1: Write a function that stutters a word as if someone is struggling to read it. The first two letters are repeated twice with an ellipsis … and space after each, and then the word is pronounced with a question mark ?.编写一个断断续续的函数,就好像有人很难读懂一个单词。前两个原创 2020-11-13 13:47:37 · 404 阅读 · 0 评论 -
Python编程基础练习——扑克牌发牌问题
采用扑克牌类设计扑克牌发牌程序。4名牌手打牌,计算机随机将52张牌(不含大小鬼)发给4名牌手,并在屏幕上显示每位牌手的牌。##设计发牌顺序:class Card: """a playing card.""" RANKS = ["A","2","3","4","5","6","7","8","9","10","J","Q","K"] #牌面数字1-13 SUITS = ["黑","红","梅","方"] def __init__(self,rank,suit,face_up=True): s原创 2020-11-11 23:58:06 · 3015 阅读 · 1 评论