zoukankan      html  css  js  c++  java
  • [Python]Python基础趣讲精练

    第一次家庭作业

    • 完成环境安装和环境测试
    • 使用print方法打印出来你的姓名年龄爱好
    • 使用print打印一个心形出来
    • 生成一个具有8位随机码,随机码包括a-z,A-Z,0-9

    1. 完成环境安装和环境测试

    2. 使用print方法打印出来你的姓名年龄爱好

    print('姓名: %s 
    年龄: %d 
    爱好: %s'%('worker',23,'读书'))
    

    结果:

    姓名: worker
    年龄: 23
    爱好: 读书

    3. 使用print打印一个心形出来

    print('''
        ***  ***
      ***********
     *************
       *********
        *******
          ***
    ''')
    

    结果:

        ***  ***
      ***********
     *************
       *********
        *******
          ***
    

    4. 生成一个具有8位随机码,随机码包括a-z,A-Z,0-9

    import string
    import random
    code = ''.join(random.sample((string.digits + string.ascii_lowercase + string.ascii_uppercase),8))
    print(code)
    

    结果:

    PdHgFbZ5

  • 相关阅读:
    Rocket
    Rocket
    Rocket
    Rocket
    POJ 1849 树的直径 Two
    SGU 495 Kids and Prizes
    HDU 4336 概率DP 状压
    HDU 4089 && UVa 1498 Activation 带环的概率DP
    SGU 149 树形DP Computer Network
    暑假集训刷题记录
  • 原文地址:https://www.cnblogs.com/jsdy/p/13507616.html
Copyright © 2011-2022 走看看