# Enter a code
students = ['Alice', 'Bob', 'Candy', 'David']
students[0] = 'Ellena'
print(students)
students.insert(1,'Alice')
print(students)
students.pop(2)
print(students)
students.append('Bob')
print(students)
students = ['Alice', 'Bob', 'Candy', 'David']
students[0] = 'Ellena'
print(students)
students.insert(1,'Alice')
print(students)
students.pop(2)
print(students)
students.append('Bob')
print(students)
2022-03-01
L=[95.5,85,59,66,72]
length=0;
i=0
j=0
for l in L:
length+=1
temp =0;
while i < length-1:
j = i+1
while j < length:
if L[i]<L[j]:
temp = L[i]
L[i] = L[j]
L[j] = temp
j+=1
i+=1
print(L[0],L[1],L[2])
length=0;
i=0
j=0
for l in L:
length+=1
temp =0;
while i < length-1:
j = i+1
while j < length:
if L[i]<L[j]:
temp = L[i]
L[i] = L[j]
L[j] = temp
j+=1
i+=1
print(L[0],L[1],L[2])
2022-02-27
s1='ABC'
s2='123'
s3='xyz'
for s11 in s1:
for s22 in s2:
for s33 in s3:
print(s11+s22+s33)
s2='123'
s3='xyz'
for s11 in s1:
for s22 in s2:
for s33 in s3:
print(s11+s22+s33)
2022-02-27
# coding: utf-8
s1 = '这是一句中英文混合的Python字符串:'
s2 = 'Hello World!'
print(s1+s2)
result = 's1{s2}'.format(s2='Hello World!')
print(result)
s1 = '这是一句中英文混合的Python字符串:'
s2 = 'Hello World!'
print(s1+s2)
result = 's1{s2}'.format(s2='Hello World!')
print(result)
2022-02-26
num = 0
sum = 0
while True:
if num>1000:
break
sum = sum + num
num = num + 2
print(sum)
sum = 0
while True:
if num>1000:
break
sum = sum + num
num = num + 2
print(sum)
2022-02-25
num = 1
plus = 1
while num <= 20:
plus = plus * num
num = num + 1
print(plus)
plus = 1
while num <= 20:
plus = plus * num
num = num + 1
print(plus)
2022-02-25
L = [75, 92, 59, 68, 99, 100, 87, 71]
sum = 0.0
count = len(L)
for score in L:
sum = sum + score
ave = sum/count
print(sum,count)
print(ave)
sum = 0.0
count = len(L)
for score in L:
sum = sum + score
ave = sum/count
print(sum,count)
print(ave)
2022-02-25
# Enter a code
age = 17
a = 'your age is {}, and you are a {}.'
if age>=18:
print(age, a.format(age, 'adult'))
else:
print(age, a.format(age, 'child'))
age = 17
a = 'your age is {}, and you are a {}.'
if age>=18:
print(age, a.format(age, 'adult'))
else:
print(age, a.format(age, 'child'))
2022-02-25
print(r'''\"To be, or not to be\": that is the question.
Whether it\'s nobler in the mind to suffer.''')
Whether it\'s nobler in the mind to suffer.''')
2022-02-23
因为短路计算,所以a=python时不计算or,直接返回python。
当b=空格,所以b=false;false or world=world
当b=空格,所以b=false;false or world=world
2022-02-20