![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
pycharm
Tom_2018
这个作者很懒,什么都没留下…
展开
-
python常识
# print 是一个函数print("hello") # 控制台输出内容# 注释快捷键:Ctrl + /type(1)type(1.5)type("hello")# 快速将代码在控制台运行:Alt + Shift + Etype('hello')type("""hello""")# 转义print('What\'s your name?')# \n 换行 \t 制表符print("12\n45\t6\n7\t89")print("12\\n45\\t6\\n7\...原创 2020-05-10 13:47:40 · 139 阅读 · 0 评论 -
把一个数组随机分组
import randomnum = int(input(('请输入一个数字:\n')))a = [[], [], [],[]]for i in range(1, num + 1): b = random.randint(0,3) a[b].append(i)for j in a: print(j)原创 2018-12-14 18:27:19 · 2510 阅读 · 0 评论 -
判断闰年
temp = input("请输入一个年份:\n")while not temp.isdigit(): temp = input("抱歉,您输入有误,请输入一个正确的年份:\n")if int(temp)%400==0: print("闰年")else: if int(temp)%4==0 and int(temp)%100!=0: print("闰年...原创 2018-12-14 18:29:19 · 158 阅读 · 0 评论 -
猜一个随机数
import randomsecret = random.randint(1,10)times =3guess = 0print("猜一个数字:",end="")while(guess != secret)and ( times > 0): temp =input() while not temp.isdigit(): temp = input("...原创 2018-12-14 18:31:19 · 262 阅读 · 0 评论 -
Python_learning_summary
0、命令行常用命令命令行(Windows下叫“命令提示符”,Mac下叫“终端”)里的常用命令。打开命令行,我们会看到每行前面都有诸如C:\Documents and Settings\Crossin>或者MyMacBook:~ crossin$之类的。这个提示符表示了当前命令行所在目录。 第一个常用的命令是:dir (windows环境下)ls ...原创 2019-01-10 10:31:28 · 542 阅读 · 0 评论