为了账号安全,请及时绑定邮箱和手机立即绑定
age = 19
if age >= 18:
temp = 'adult {}'
print(temp.format(age))
# Enter a code
template = 'Life is {0}, {1} {2} {3}'
template1 = 'Life is {a},{b},{c} {d}'
print(template.format("short","you","need","python"))
aa='short'
bb = 'you'
cc = 'need'
dd = 'python'
print(template1.format(a=aa,b=bb,c=cc,d=dd))
print(r'''To be, or not to be: that is the question.Whether it's nobler in the mind to suffer.''')
最大的难度在于求表面积公式
Python遍历dict
通过直接print(d),我们打印出来的是完整的一个dict;有时候,我们需要把dict中m(满足)一定条件的元素打印出来
def sub_sum(n):
if n <= 0:
return 0
return n+sub_sum(n-1)
n=100
print(sub_sum(n))

最新回答 / 不吃香菜吖
d = {    'Alice': 45,    'Bob': 60,    'Candy': 75,    'David': 86,    'Ellena': 49}# name = input('to del whose score:')name = 'Alice'try:    d.pop(name)    print(name + ' deleted')except:    print(name + ' none')

最新回答 / top_zq
打印打了个寂寞,位置没有对其
浮点数,字符串,整数,二进制数
# 方法一
template1 = 'Life is {0}, you need {1}'
print(template1.format('short', 'Python'))
# 方法二
template2 = 'Lift is {p1}, you need {p2}'
print(template2.format(p1 = 'short', p2 = 'Python'))
常见的编辑器:Sublime Text3,VisualCode,PyCharm等
为什么从这节课开始我就看不到视频了,帮忙指导一下

最新回答 / 幸福的棉花糖
需要,你这个不是字符串连接,如果连接应该使用 print('abult' + age)

最新回答 / 幸福的棉花糖
在交互式环境中,执行上述代码后,会直接输出 3.14,而不需要显式调用 print()。这是因为 Python 的交互式环境会将表达式的计算结果作为返回值自动显示。然而,在脚本文件(如 .py 文件)中运行相同的代码时,如果没有使用 print(),则不会输出任何内容,因为脚本模式不会自动打印表达式的返回值。因此,在脚本中需要显式使用 print() 来显示结果
课程须知
如果您了解程序设计的基本概念,会简单使用命令行,了解中学数学函数的概念,那么对课程学习会有很大的帮助,让您学起来得心应手,快速进入Python世界。
老师告诉你能学到什么?
通过本课程的学习,您将学会搭建基本的Python开发环境,以函数为基础编写完整的Python代码,熟练掌握Python的基本数据类型以及list和dict的操作,灵活使用流程控制语句。

微信扫码,参与3人拼团

微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

友情提示:

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

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消