程序将数字的平方存储在Python中的相同变量中 [英] Program to store the square of a number in same variable in Python
本文介绍了程序将数字的平方存储在Python中的相同变量中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
import math
i=0
i = math.pow(i, 2)
print(i)
我尝试了什么:
我想要我在i的商店广场为什么它显示为0.
我只知道c编程,我是python的新手,
i和c变量一样思考内存分配
我该怎么做才能解决这个问题?
What I have tried:
I want to store square of i in i why it is showing 0.
I know only c programming, i am new to python ,
i am thinking in the same way as in c variable memory allocations
what should i do to fix this?
推荐答案
这是基础数学。什么是0
×0
?
显示0
因为0
2
≡0
。
This is basic mathematics. What is0
×0
?
It's showing0
because0
2
≡0
.
Quote:
I我希望在i中存储i的原因为什么它显示为0。
I want to store square of i in i why it is showing 0.
你期望得到什么结果?
你怎么能说你想知道的事情并且同时不明白为什么0的平方为0?
看起来你需要刷新你的数学知识。
What result did you expect ?
How can you speak of squaring like something you know and at same time not understanding why the square of 0 is 0 ?
Looks like you need to refresh your math knowledge.
这篇关于程序将数字的平方存储在Python中的相同变量中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文