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

 

posted @ 2017-08-23 23:03  枪与玫瑰  阅读(129)  评论(0编辑  收藏  举报