码迷,mamicode.com
首页 > 编程语言 > 详细

《Python编程:从入门到实践》第二章 变量和简单数据类型 习题答案

时间:2019-08-29 16:05:09      阅读:61      评论:0      收藏:0      [点我收藏+]

标签:class   nes   happy   pytho   演示   self   print   elf   mes   

#2.1
print("Hello world!");
#2.2
message="Hello,Python!";
print(message);
#2.3
name="tian jiale";
print(name+",would you like to learn some Python today?");

#2.4
 #小写
print(name.lower()+",would you like to learn some Python today?");
 #大写
print(name.upper()+",would you like to learn some Python today?");
 #首字母大写
print(name.title()+",would you like to learn some Python today?");

#2.5
name="Myself";
message="Study makes me happy,study is resoure of my happiness!";
print(name+" once said,"+message);
#2.6
famous_person="Myself";
print(famous_person+" once said,"+message);
#2.7
name="\tMyself\n";
print(name);
print(name.lstrip()+" once said,"+message);
print(name.rstrip()+" once said,"+message);
print(name.strip()+" once said,"+message);

#2.8
print(5+3);
print(8-0);
print(2*4);
print(int(16/2));

#2.9
"""
这是一个注释
而且是多行注释
这个程序的目的就是为了演示注释
"""
print("这个程序的目的就是为了演示注释!");
#2.10
import this

 

《Python编程:从入门到实践》第二章 变量和简单数据类型 习题答案

标签:class   nes   happy   pytho   演示   self   print   elf   mes   

原文地址:https://www.cnblogs.com/zijeak/p/11429882.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!