day01-开始系统学习python

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了day01-开始系统学习python相关的知识,希望对你有一定的参考价值。

#! /usr/bin/env/python3
# -*- coding: utf-8 -*-
import numpy as np
print(hello world!)

int_a=3
int_b=int_a
print(id(int_a),id(int_b))
int_a=5
print(id(int_a),id(int_b))

#user interchange
# bool_check=True
# while bool_check:
#     name=input("Please input your name:\n")
#     bool_check=(name[0]>=‘a‘ and name[0]<=‘z‘) or (name[0]>=‘A‘ and name[0]<=‘Z‘)
#     if bool_check==False:
#         print("Please input your name again(first word should be char type).\n")
#         bool_check=True
#     else:
#         bool_check=False


a=10
print(eval(a))

_num=np.random.randint(1,11)
iter=0
chance=5
while iter<chance:
    num=input("Please guess the num between(1,10),you still have %d chance:"% (chance-iter))
    try:
        num=int(num)
    except ValueError:
        print("input num please.\n")
        continue
    if num==_num:
        print(You WIN!!!)
        break
    elif num>_num:
        print(Bigger.)
        iter+=1
    else:
        print(Smaller.)
        iter+=1

 

以上是关于day01-开始系统学习python的主要内容,如果未能解决你的问题,请参考以下文章

Python学习day01

坚持Selenium+Python学习之从读懂代码开始 DAY1

Python学习之路day01——if语句

从零开始学Python-day2

学习笔记:python3,代码片段(2017)

python学习day01 数据类型 if while