Discuss / Python / 作业

作业

Topic source

x = int(input(请输入x的值)) y = int(input(请输入y的值)) print('x y =', x y) print 里面 x y之间有*号的,编辑器没出来。。

print 引号里面的不是字符串么,难道这个结果不是 x * y = 786432

xuyabono15

#3 Created at ... [Delete] [Delete and Lock User]

x=int(input()) 1024 y=int(input()) 768 print(x,'',y,'=',xy) 1024 * 768 = 786432

为什么要加int呢 能说下 为什么吗。 int的具体用处是什么呢

黑氏

#5 Created at ... [Delete] [Delete and Lock User]

加int 是把输入的字符串转换为数值,不然 input 你输入的1024 是字符串 没办法进行运算的


  • 1

Reply