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

Python语法基础

时间:2016-08-18 23:25:47      阅读:206      评论:0      收藏:0      [点我收藏+]

标签:

# coding=utf-8
import random



teacher = (1 < 3) and (2 > 5)
print (teacher)

index = random.randint(1, 10)
print (index)

a = True * True
print ("a = " + str(a))

b = 5
print float(b)

print "type = " + str(type(b))

print isinstance(a, float)

c = 10
c %= 2
print "c = " + str(c)

d = 5;
print d or c

x, y = 4, 5

print x if x < y else y

jso
assert 3 < 4


menber = [‘葫芦娃‘,3.14,‘mm‘,‘dd‘,‘hh‘]
for i in menber:
print(i,len(menber))

for j in range(0,10):
print(-j)

menber.extend([‘1‘,‘2‘])
menber.insert(1,‘gggg‘)
print menber




print (‘------------------Edwin-------------------‘)
temp = input("不妨猜一下我现在心里想的是哪个数字:")
guess = int(temp)
while guess != 8:
temp = input("不妨猜一下我现在心里想的是哪个数字:")
guess = int(temp)
if guess == 8:
print ("我草,你是我心里的蛔虫吗?")
else:
if guess > 8:
print ("哥,大了大了~ ~");
else:
print ("嘿,小了!小了~~!")
print ("游戏结束,不玩啦")

Python语法基础

标签:

原文地址:http://www.cnblogs.com/why168888/p/5785802.html

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