a = ['1','2','3']#a赋值为中括号里的集合
b = ['4','5']
print(a[1])#输出a的第二个元素
print(b[-1])#输出b的最后一个元素
print(a[0])#输出a的第一个元素
print(a[1:])##打印第一个元素之后的内容
print(a[:-1])##打印最后一个元素之前的内容
print(a[::-1])##倒序输出
print(a * 3)##输出三遍
print(a+b)#链接a和b
for c in range(0,10):#c在0到10的范围内(包括0不包括10)
print(c)#输出次数
......................
阅读全部
|
绘子手
贴于 2021年12月25日 22:22
hide
bbsi
import turtle as t
def rectangle(horizontal, vertical, color):
t.pendown()
t.pensize(1)
t.color(color)
t.begin_fill()
for counter in range(1,3):
t.forward(horizontal)
t.right(90)
t.forward(vertical)
t.right(90)
t.end_fill()
......................
阅读全部
|
单俊杰
贴于 2021年12月12日 16:10
hide
bbsi
n= int(input())
cp = list()
for i in range(n):
cp.append(input().split())
m = input()
dog = input().split()
dog = set(dog)
for c in cp:
if c[0] in dog and c[1] in dog:
dog.remove(c[0])
dog.remove(c[1])
......................
阅读全部
|
GunL
贴于 2021年12月11日 21:59
hide
bbsi
#tempConvert.py
TempStr = input("请输入带有符号的温度值")
if TempStr[-1] in ['F','f ']:
c = (eval(Tempstr[0:-1])- 32 )/1.8
print("转换后的温度是{:.2f}C".format(C))
elif TempStr[-1] in ['C','c']:
F = 1.8*eval(TempStr[0:-1]) + 32
print("转换后的温度是{:.2f}F".format(F))
else:
print("输入格式错误")
阅读全部
|
一念永恒
贴于 2021年11月26日 16:02
hide
bbsi
print("我在中国学Python\n")
# 练习一下循环的使用
for i in range(1, 21):
print(f"我爱编程中国 {i} 次")
阅读全部
|
TY时代站长
贴于 2021年11月14日 19:44
hide
bbsi
while Ture:
print('who are you?')
name=input()
if name!='mark':
continue
print('hi,mark.what is the password?(It is a fish.)')
password=input()
if password=input()
break
print('access granted.')
阅读全部
|
TY时代站长
贴于 2021年11月14日 19:40
hide
bbsi