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.''')
2021-06-17
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)
这样可以么
2021-06-16
L = [[1, 2, 3], [5, 3, 2], [7, 3, 2]]
for a in L:
sa = (a[0]*a[1]+a[1]*a[2]+a[0]*a[2])*2
print(sa)
22
62
82
for a in L:
sa = (a[0]*a[1]+a[1]*a[2]+a[0]*a[2])*2
print(sa)
22
62
82
2021-06-12
def greet(s='world'):
return 'Hello,{}.'.format(s)
print(greet())
print(greet('Python'))
输出:
Hello,world.
Hello,Python.
return 'Hello,{}.'.format(s)
print(greet())
print(greet('Python'))
输出:
Hello,world.
Hello,Python.
2021-06-10
num = 0
sum = 0
while True:
if num > 1000:
break
if num % 2 == 0 :
sum = num + sum
num = num + 1
print(sum) =》 250500
sum = 0
while True:
if num > 1000:
break
if num % 2 == 0 :
sum = num + sum
num = num + 1
print(sum) =》 250500
2021-06-10
d = {'Alice': [50, 61, 66], 'Bob': [80, 61, 66], 'Candy': [88, 75, 90]}
for key in d:
value = d[key]
for ch in value:
print (key,ch)
for key in d:
value = d[key]
for ch in value:
print (key,ch)
2021-06-04
print("这是一句中英文混合的%s字符串:%s"%("python","Hello\tWorld"))
2021-06-02
template1="Life is short"
template2="you need python"
print("{0},{1}".format(template1,template2))
template="{L},{y}"
L="life is short"
y="you need python"
print(template.format(L=L,y=y))
template2="you need python"
print("{0},{1}".format(template1,template2))
template="{L},{y}"
L="life is short"
y="you need python"
print(template.format(L=L,y=y))
2021-06-02
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.''')
2021-06-02
L = ['Alice', 'Bob', 'Candy', 'David', 'Ellena']
S=[89, 72, 88, 79, 99]
Ss=[89, 72, 88, 79, 99]
def getnames(name):
return Ss.index(name)
S.sort(reverse=True);
for sa in S:
print(sa)
print(L[getnames(sa)])
print(r'''
''')
S=[89, 72, 88, 79, 99]
Ss=[89, 72, 88, 79, 99]
def getnames(name):
return Ss.index(name)
S.sort(reverse=True);
for sa in S:
print(sa)
print(L[getnames(sa)])
print(r'''
''')
2021-05-31
a = 'python'
print('hello,'+( a or 'world'))
b = ''
print('hello,'+(b or 'world'))
print('hello,'+( a or 'world'))
b = ''
print('hello,'+(b or 'world'))
2021-05-31
L = [95.5, 85, 59, 66, 72]
L.sort(reverse=True)
for i in range(3):
print(L[i])
L.sort(reverse=True)
for i in range(3):
print(L[i])
2021-05-29
c = '{0},{1}'
C=c.format('Life is short', 'you need Python')
print(C)
C=c.format('Life is short', 'you need Python')
print(C)
2021-05-27