为了账号安全,请及时绑定邮箱和手机立即绑定
# Enter a code
n=1
result = 1
while n<=10:
result *= n
n+=1
print (result)
# -*- coding:utf-8 -*-
# Enter a code
age = 19
if age >= 18:
print('adult {}'.format(age))
else:
print("未成年")
obj = 'AABCDEFGHHIJ'
print(obj[1:-3])
template = 'Life is {0}, you need {1}'
result = template.format('short',"Python")
print result

template = 'Life is {s}, you need {p}'
longitude='short'
language="Python"
result = template.format(s=longitude,p=language )
print result
spstr1,spstr2,spstr3 = '\',\"','\\,\\\\','\\n\\t'
print('special string: ',spstr1,spstr2,spstr3)
agr = 18
if agr < 3:
print('baby')
else:
if agr > 17:
print('adult')
else:
if agr > 7:
print('teenager')
else:
print('kid')
num=0
sum=1
while num<=9:
num=num+1
sum=sum*num
print(sum)
写程序看来数学的基础概念必须明了切扎实。
print (‘hello word’)
>>> print('holo,',b or 'world')
holo, world
>>> print('holo',b or 'world')
holo world
>>> a='python'
>>> print('holo',a or 'world')
holo python
>>> print('holo,',a or 'world')
holo, python
浮点数
字符串
整数
整数
# Enter a code
def greet(what = 'world'):
print('Hello,{}'.format(what))
# Enter a code
def func(x):
if isinstance(x, list):
return sum(x)
elif isinstance(x, tuple):
multi = 1
for n in x:
multi *= n
return multi
# coding=utf-8
def sum_func(n):
if n <= 1:
return 1
else:
return (n + sum_func(n-1))


def sum_for():
total = 0
for n in range(1, 101):
total += n
return total
课程须知
如果您了解程序设计的基本概念,会简单使用命令行,了解中学数学函数的概念,那么对课程学习会有很大的帮助,让您学起来得心应手,快速进入Python世界。
老师告诉你能学到什么?
通过本课程的学习,您将学会搭建基本的Python开发环境,以函数为基础编写完整的Python代码,熟练掌握Python的基本数据类型以及list和dict的操作,灵活使用流程控制语句。

微信扫码,参与3人拼团

意见反馈 帮助中心 APP下载
官方微信
友情提示:

您好,此课程属于迁移课程,您已购买该课程,无需重复购买,感谢您对慕课网的支持!

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消