码迷,mamicode.com
首页 > 编程语言 > 详细

day01-开始系统学习python

时间:2017-08-24 00:15:51      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:value   color   pytho   int   and   ==   span   input   big   

#! /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

标签:value   color   pytho   int   and   ==   span   input   big   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!