【发布时间】:2020-05-17 14:21:21
【问题描述】:
让我先说我对编码很陌生。 我将在这里粘贴我的代码,我只想知道它有什么问题。它旨在成为 BMI 计算器。
import math
print('input your height and weight to find BMI.')
num_a = int(input("feet=="))
num_b = int(input("inches=="))
num_c = int(input("weight(lbs)=="))
def weight():
int(num_c) * 2.2
def height():
(int(num_a)) * 12 + int(num_b)
def height_meters():
(int(height)) * 0.0254
def height_meters_sq():
math.sqrt(int(height_meters))
def bmi():
(int(weight)) / int(height_meters_sq)
print("Your BMI is..")
print(bmi)
每当最后的打印功能运行时,弹出的都是
函数 bmi 位于 0x7f2971a3e268
感谢任何帮助/批评,因为我仍在努力学习。
【问题讨论】:
-
很抱歉,您到底要问什么?这里有很多要解决的问题,不幸的是,StackOverflow 不是一个教程服务,而是用于询问/回答特定编码问题。对于这些开放式问题,您可以考虑使用 reddit 之类的方法
-
你似乎错过了一些 Python 的基础知识。我建议您为此在线阅读众多教程之一。这个网站是回答关于代码问题的问题,而不是教它
-
注意:您输入的重量(磅)乘以 2.2,这是错误的。
-
嗨@glitched,欢迎来到该网站。没有必要在问题中编辑说明您的问题已解决的注释,也没有必要为此编写答案。如果有帮助您解决问题的答案,请随意投票并将其标记为已接受,以表示您的赞赏和问题已解决。考虑使用tour 并阅读How to Ask
标签: python python-3.x