python05

d.keys/values/items

for m in range(1,10):
   
for n in range(1,m+1):
       
print("{0}*{1}={2}".format(m,n,(m*n)),end="\t")
   
print()

 

my_text="i love you,i love sxt,i love gaoqi"
char_count={c:my_text.count(c) for c in my_text}
print(char_count)

gnt=(x for x in range(4))
#print(tuple(gnt))
for x in gnt:
   
print(x,end=",")

 

绘制不同颜色的多个同心圆

import turtle

t=turtle.Pen()

my_colors=(
"red","green","yellow","black")

t.width(
4)
t.speed(
1)
for i in range(10):
    t.penup( )
    t.goto(
0,-i*10)
    t.pendown( )
    t.color(my_colors[i%
len(my_colors)])
    t.circle(
15+i*10)

turtle.done( )

Return两个作用 1.返回值 2.结束函数的执行

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值