# 01-Check Yourself：Types and Operators

AI悦创原创NYU Python题解NYU Python 辅导Python一对一教学题解NYU Python题解NYU Python 辅导Python一对一教学题解大约 2 分钟...约 620 字

1. Give the values printed by the following program for each of the labeled lines and answer the associated questions.

``````a_float = 2.5
a_int = 7
b_int = 6
print(a_int / b_int)    # Line 1
print(a_int // a_float) # Line 2
print(a_int %  b_int)   # Line 3
print(int(a_float))     # Line 4
print(float(a_int))     # Line 5
``````

(a) Line 1: what is printed; what is its type?

(b) Line 2: what is printed; what is its type?

(c) Line 3: what is printed; what is its type?

(d) Line 4: what is printed; what is its type?

(e) Line 5: what is printed; what is its type?

1. Give the values printed by the following program for each of the labeled lines.

``````a_int = 10
b_int = 3
c_int = 2

print(a_int + b_int * c_int)      # Line 1
print( (a_int + b_int) * c_int )  # Line 2
print(b_int ** c_int)             # Line 3
print(0o10 + c_int)               # Line 4
``````

(a) What is printed by Line 1?

(b) What is printed by Line 2?

(c) What is printed by Line 3?

(d) What is printed by Line 4?

AI悦创·编程一对一

AI悦创·推出辅导班啦，包括「Python 语言辅导班、C++ 辅导班、java 辅导班、算法/数据结构辅导班、少儿编程、pygame 游戏开发，华为 Python 机试」，全部都是一对一教学：一对一辅导 + 一对一答疑 + 布置作业 + 项目实践等。当然，还有线下线上摄影课程、Photoshop、Premiere 一对一教学、QQ、微信在线，随时响应！微信：Jiabcdefh

C++ 信息奥赛题解，长期更新！长期招收一对一中小学信息奥赛集训，莆田、厦门地区有机会线下上门，其他地区线上。微信：Jiabcdefh

• 0
• 0
• 0
• 0
• 0
• 0

• 按正序
• 按倒序
• 按热度