Commit 530290f0 by BellCodeEditor

auto save

parent bd57e711
sb=input()
lst=sb.split(' ')
print('~'.join(lst))
a=input()
b=input()
c=input()
count=0
lst=b.split(" ")
for i in lst:
if i !=c:
count=count+int(i)
print(count)
\ No newline at end of file
# 尝试编写func()函数输出斐波那契数列的第十五个数是什么?
# 斐波那契数列:1,1,2,3,5,8,13,21,34,55……
def func(n):
if n<=2:
return 1
else:
a=func(n-1)+func(n-2)
return a
字符串.find()
字符串.rfind()
split()
input() 通过input获取的类型都是字符串
int() 整数
s=input
s_lst = s.split(",") 假如s="1,2,3,4,5,6"
那么s.split=["1","2",.........]
print(['~'.join(lst)])
......@@ -17,5 +64,4 @@ def func(n):
print(func(15)) #调用函数并打印结果
lst=[]
for i in range(len(lst)):
print("第"(i+1),"tszdfvghjn:",lst[1])
\ No newline at end of file
lst=[]
for i in range(len(lst)):
print("第"(i+1),"tszdfvghjn:",lst[1])
\ No newline at end of file
lst=['hello','python','world']
print(['~'.join(lst)])
\ No newline at end of file
wc=input()
print(wc.upper())
\ No newline at end of file
a=input()
b=input()
c=input()r
count=0
lst=b.split(" ")
for i in lst:
if i == c:
count=count+1
print(count)
\ No newline at end of file
a.extend()
a.extend()
a.insert(2,4) 在列表索引2的地方插入4
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment