最新回答 / qq_慕神6096684
#Enter a code翻译:#请输入代码A='AABCDEFGHHIJ'翻译:A是变量名,定义A=AABCDEFGHHIJS=A[1:9]翻译:S也是变量名,定义S=A的第2到8位(在程序的世界中,第一个数字是0)print(S)翻译:print(打印),S(变量名);print(S)打印S的意思,结果是:ABCDEFGH
2023-08-20
最新回答 / 慕运维2498310
变量名由大小写英文字母、数字和下划线_组成变量不能用数字开头变量尽量不要和Python关键字重合(比如前面学习过的:and、or、not,否则可能导致Python原有关键字发挥不出作用)
2023-08-14
最容易理解的
def greet(param):
if param == None:
print('Hello World')
else:
print('Hello,{}'.format(param))
greet('Python')
def greet(param):
if param == None:
print('Hello World')
else:
print('Hello,{}'.format(param))
greet('Python')
2023-08-11
最新回答 / weixin_慕侠6466137
在浏览器搜索python,进入官网,找到3.8版的,一定要按照电脑适配的位数,比如Windows64位就下载64位,Windows32位就下载32位。还有一个方法摁住Windows键再摁下R键,会在左下角弹出一个对话框,输入cmd或者python回车就可以了
2023-08-07
>>> print(type(3.1415926))
<class 'float'>
>>> print(type('Learn Python in imoc'))
<class 'str'>
>>> print(type(100))
<class 'int'>
>>> print(type(0b1101))
<class 'int'>
>>>
<class 'float'>
>>> print(type('Learn Python in imoc'))
<class 'str'>
>>> print(type(100))
<class 'int'>
>>> print(type(0b1101))
<class 'int'>
>>>
2023-08-03
names = ['Alice', 'Bob', 'Candy', 'David', 'Ellena']
names.append('Zero')
names.insert(5,'Phoebe')
names.insert(-2,'Gen')
print(names)
names.append('Zero')
names.insert(5,'Phoebe')
names.insert(-2,'Gen')
print(names)
2023-08-02
d = {
'Alice': [45],
'Bob': [60],
'Candy': [75],
}
d['Alice'] = [50,61,66]
d['Bob'] = [80,61,66]
d['Candy'] = [88,75,90]
print(d)
'Alice': [45],
'Bob': [60],
'Candy': [75],
}
d['Alice'] = [50,61,66]
d['Bob'] = [80,61,66]
d['Candy'] = [88,75,90]
print(d)
2023-07-29
a=2
at=0
while a<=1000:
if a == 1000:
break;
at+=a
a=a+2
print(at)
at=0
while a<=1000:
if a == 1000:
break;
at+=a
a=a+2
print(at)
2023-07-26
template = 'Life is short,{}'
A = 'you need Python'
result = template.format(A)
print(result)
template = 'Life is short,{}'
result = template.format('you need Python')
print(result)
A = 'you need Python'
result = template.format(A)
print(result)
template = 'Life is short,{}'
result = template.format('you need Python')
print(result)
2023-07-26