写文章 注册 登录
  • 首页
  • 下载App
  • 会员
  • IT技术
240
发简信
python伍佰本修炼秘籍
  • 0

    关注
  • 1

    粉丝
  • 17

    文章
  • 1597

    字数
  • 0

    收获喜欢
IP属地:广东
  • 文章
  • 动态
  • 最新评论
  • 热门
  • 180
    python伍佰本修炼秘籍
    18-猜数,直到猜对

    import random num = random.randint(1, 10)running = True while running:answer = int(inpu...

    441 0 0
  • 180
    python伍佰本修炼秘籍
    17-改进的石头剪刀布

    import random all_choices = ['石头', '剪刀', '布']win_list = [['石头', '剪刀'], ['剪刀', '布'], ['布...

    1261 0 0
  • 180
    python伍佰本修炼秘籍
    16-石头剪刀布

    import random all_choices = ['石头', '剪刀', '布']computer = random.choice(all_choices)playe...

    825 0 0
  • 180
    python伍佰本修炼秘籍
    15-成绩分类2

    score = int(input('分数: ')) if score >= 60 and score < 70:print('及格')elif 70 <= score < ...

    1228 0 0
  • 180
    python伍佰本修炼秘籍
    14-成绩分类1

    score = int(input('分数: ')) if score >= 90:print('优秀')elif score >= 80:print('好')elif sc...

    858 0 0
  • 180
    python伍佰本修炼秘籍
    13-猜数:基础实现

    import random num = random.randint(1, 10) # 随机生成1-10之间的数字answer = int(input('guess a nu...

    929 0 0
  • 180
    python伍佰本修炼秘籍
    12-判断练习:用户名和密码是否正确

    import getpass # 导入模块 username = input('username: ') getpass模块中,有一个方法也叫getpass passwor...

    1118 0 0
  • 180
    python伍佰本修炼秘籍
    11-条件表达式、三元运算符

    a = 10b = 20 if a < b:smaller = aelse:smaller = b print(smaller) s = a if a < b else b ...

    890 0 0
  • 180
    python伍佰本修炼秘籍
    10-基本判断

    单个的数据也可作为判断条件。任何值为0的数字、空对象都是False,任何非0数字、非空对象都是True。if 3 > 0:print('yes')print('ok') if...

    1040 0 0
  • 180
    python伍佰本修炼秘籍
    09-字典基础

    字典是key-value(键-值)对形式的,没有顺序,通过键取出值 adict = {'name': 'bob', 'age': 23}len(adict)'bob' in ...

    663 0 0
  • 180
    python伍佰本修炼秘籍
    08-元组基础

    元组与列表基本上是一样的,只是元组不可变,列表可变atuple = (10, 20, 30, 'bob', 'alice', [1,2,3])len(atuple)10 in...

    968 0 0
  • 180
    python伍佰本修炼秘籍
    07-列表基础

    列表也是序列对象,但它是容器类型,列表中可以包含各种数据alist = [10, 20, 30, 'bob', 'alice', [1,2,3]]len(alist)alis...

    1235 0 0
  • 180
    python伍佰本修炼秘籍
    05-字符串使用基础

    python中,单双引号没有区别,表示一样的含义sentence = 'tom's pet is a cat' # 单引号中间还有单引号,可以转义sentence2 = "...

    1735 0 0
  • 180
    python伍佰本修炼秘籍
    04-输入输出基础练习

    username = input('username: ')print('welcome', username) # print各项间默认以空格作为分隔符print('w...

    50 0 0
  • 180
    python伍佰本修炼秘籍
    03-input

    number = input("请输入数字: ") # input用于获取键盘输入print(number)print(type(number)) # input获得的数...

    1631 0 0
  • 180
    python伍佰本修炼秘籍
    02-基本运算

    运算符可以分为:算术运算符、比较运算符和逻辑运算符。优先级是:算术运算符>比较运算符>逻辑运算符。不过呢,开始没背下来优先级,最好使用括号。这样不用背,也增加了代码的可读性。...

    832 0 0
  • 180
    python伍佰本修炼秘籍
    01-print

    print('hello world!')print('hello', 'world!') # 逗号自动添加默认的分隔符:空格print('hello' + 'world!...

    825 0 0
  • 180
    python伍佰本修炼秘籍
    180
    python百例

    凯茜的老爸 编,131 篇文章,1671 人关注

    任何一种新的技能都需要反复练习。在此专为我的学生们准备python入门级代码,只要能把这些例子熟记于心,便可以积少成多,积水成渊。所有例子均在CentOS7下完成,采用了python3.6.x。
  • 180
    python伍佰本修炼秘籍
暂无个人介绍
  • 他关注的专题/文集/连载
  • 他喜欢的文章