python - 当我完成此代码时,我收到“TypeError:'>' 在 'float' 和 'str' 的实例之间不支持”。我究竟做错了什么?
问题描述
这是代码
wagesAmount = float(input("Enter Wages Amount: "))
numberOfHours = float(input("Enter Number Of Hours Worked: "))
totalWagesAmount = (wagesAmount) * (numberOfHours)
if totalWagesAmount > "0":
printtotalWagesAmount
我还需要添加一个 else 语句,但我只是想先解决这个问题
解决方案
你必须删除""
on0
因为"0" != 0
if totalWagesAmount > 0:
推荐阅读
- reactjs - 在 npm 更新后反应无状态组件损坏
- ios - Google geocoding api OVER_QUERY_LIMIT 在 5 次请求后发生
- linux - 构建 SELinux 映像 - RPM 包编译错误
- vba - VBA 另存为自定义文件
- asp.net - HttpClient - 没有 mediatypeformatter 可用于读取“模型”类型的对象
- ios - iOS:创建共享代码的项目
- c# - 在c#中反序列化包含数组的Json数据
- jquery - 从 JQuery 中的字符串中提取 HTML 内容
- image - 如何检测压缩图像是否是从未压缩的图像创建的
- javascript - 不要在 html 标签内执行 javascript