变量和简单数据类型 习题答案

Posted zijeak

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了变量和简单数据类型 习题答案相关的知识,希望对你有一定的参考价值。

#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编程从入门到实践》变量和简单数据类型

Python编程:从入门到实践chapter2 变量和简单数据类型

《Python编程从入门到实践》第二章_变量和简单数据类型

《Python编程:从入门到实践》课后习题及答案

《python编程:从入门到实践》课后习题及答案