首页 > 编程语言 > 详细

day01-开始系统学习python

时间:2017-08-23 23:30:18      阅读:253      评论:0      收藏:0      [点我收藏+]
#! /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

原文:http://www.cnblogs.com/Franklin-Kite/p/7420718.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!