age =16
if age >17:
print('adult')
else:
print('teenager')
if age >17:
print('adult')
else:
print('teenager')
2021-03-25
# Enter a code
n = 1
s = 0
while True:
if n >= 10:
break
n = n + 1
if n % 2 == 0:
s = s + n
print(s)
n = 1
s = 0
while True:
if n >= 10:
break
n = n + 1
if n % 2 == 0:
s = s + n
print(s)
2021-03-25
age = 19
if age >= 18:
print('your age = {}'.format(age))
print('adult')
if age >= 18:
print('your age = {}'.format(age))
print('adult')
2021-03-25
>>> r = 'you need Python'
>>> template = 'Life is short,{}'
>>> result = template.format(r)
>>> print(result)
Life is short,you need Python
>>> template = 'Life is short,{w}'
>>> w = 'you need Python'
>>> result = template.format(w=w)
>>> print(result)
Life is short,you need Python
>>>
>>> template = 'Life is short,{}'
>>> result = template.format(r)
>>> print(result)
Life is short,you need Python
>>> template = 'Life is short,{w}'
>>> w = 'you need Python'
>>> result = template.format(w=w)
>>> print(result)
Life is short,you need Python
>>>
2021-03-25
最赞回答 / 慕丝7207896
你的变量K没有递增啊,正确代码如下def l_sum1(k): a = 0 b = 0 while b <= k: a += b b += 1 return aprint(l_sum1(100))
2021-03-25
T = (1, 'CH', [3, 4])
T = list(T)
T[2]=tuple(T[2])
print(tuple(T))
T = list(T)
T[2]=tuple(T[2])
print(tuple(T))
2021-03-23
最新回答 / 慕粉1217398274
取模运算的结果就是除法运算的余数,99/30=3余9所以99%3的结果就是9,==>没什么用就是表示个箭头,后面是这行程序运行的结果,#是注释,#后面的部分只会作为文本显示,不作为程序运行
2021-03-22
最新回答 / 慕运维1448452
额,,,,,短路计算,a and b 如果a是false 那么输出就是a 如果a是true 那么输出无论b是true或者false,都是b。你这里a=“pd”然后print(“hello”,a and “world”)a已经赋值字符串pd应该是true!
2021-03-22
已采纳回答 / qq_加油少年_2
template="Life is short,{} " data="you need Python."result=template.format(data) print(result)不要全部写在一行啊
2021-03-21