跳至主要內容

01-Check Yourself:Types and Operators

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

  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
题目 EN

(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
题目 EN

(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悦创·编程一对一

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

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

方法一:QQopen in new window

方法二:微信:Jiabcdefh

上次编辑于:
贡献者: AI悦创,AndersonHJB
你认为这篇文章怎么样?
  • 0
  • 0
  • 0
  • 0
  • 0
  • 0
评论
  • 按正序
  • 按倒序
  • 按热度