输入未按预期打印
#该程序应允许用户输入其体重,并计算他们应根据该数字提出多少 蹲和长凳的条款。
x = int(输入(“我制作的这个程序是为了计算您应该蹲多少。您的权重多少?:”))) y = int(输入(“我制作的这个程序是为了计算您应该进行多少板凳。您的权重多少?:”))) def squat(x): x =蹲 squat< 165和squat> 145: 打印(“您已经落入145-165磅的范围。在此重量级时,您应该能够蹲下100-110磅。”) 如果squat< 181和squat> 166: 打印(“您已经落入166-181磅的范围。在此重量级时,您应该能够蹲110-120磅。”) Elif squat< 198和squat> 182: 打印(“您已经落入182-198磅的范围。 Elif squat< 220和squat> 199: 印刷(“您已经落入199-220磅的范围。 Elif squat< 242和squat> 200: 打印(“您已经跌入200-242磅的范围。 Elif squat< 275和squat> 242: 打印(“您已经落入242-275磅的范围。在此重量级时,您应该能够蹲下135-140磅。”) Elif squat< 319和squat> 243: 打印(“您已经跌入243-319磅的范围。在此重量级时,您应该可以蹲下140-145磅。 else:squat> 320 打印(“您已经落入320磅以上的范围。在此重量级时,您应该能够蹲约150磅。”) DEF板凳(Y): y =替补板 而替补席165和Bench> 148: 打印(“您已经跌入148-165磅的范围。在此重重时,您应该能够坐下110-120磅的尺寸。”) 如果长凳< 181和Bench> 166: 打印(“您已经落入166-181磅的范围。在此重量级时,您应该能够坐在110-120磅的座位上。”) Elif Bench< 198和Bench> 182: 打印(“您已经落入182-198磅的范围。 Elif Bench< 220和Bench> 198: 印刷(“您已经进入198-220磅的范围。 Elif Bench< 242和Bench> 221: 打印(“您已经落入221-242磅的范围。在此重量级时,您应该能够坐下130-135磅。”) Elif Bench< 275和Bench> 243: 打印(“您已经落入243-275磅的范围。在此重量级时,您应该可以坐下135-140磅。”) Elif Bench< 319和Bench> 275: 打印(“您已经落入243-275磅的范围。在此重重时,您应该能够坐下140-145磅的长凳。”) else:bench> 320 打印(“您已经落入320磅以上的范围。在此重量级时,您应该能够坐150磅。”) 打印(蹲(x),长凳(y))
#this program should allow a user to input their bodyweight and calculate how much they should be lifting based off of that number in
terms of squat and bench.x = int(input("This program I made is to calculate how much you should be squatting. How much do you weight?: ")) y = int(input("This program I made is to calculate how much you should be benching. How much do you weight?: ")) def squat(x): x = squat while squat < 165 and squat > 145: print("You have fallen into the range of 145-165 lbs. At this weightclass you should be able to squat 100-110 lbs.") if squat < 181 and squat > 166: print("You have fallen into the range of 166-181 lbs. At this weightclass you should be able to squat 110-120 lbs.") elif squat < 198 and squat > 182: print("You have fallen into the range of 182-198 lbs. At this weightclass you should be able to squat 120-125 lbs.") elif squat < 220 and squat > 199: print("You have fallen into the range of 199-220 lbs. At this weightclass you should be able to squat 125-130 lbs.") elif squat < 242 and squat > 200: print("You have fallen into the range of 200-242 lbs. At this weightclass you should be able to squat 130-135 lbs.") elif squat < 275 and squat > 242: print("You have fallen into the range of 242-275 lbs. At this weightclass you should be able to squat 135-140 lbs.") elif squat < 319 and squat > 243: print("You have fallen into the range of 243-319 lbs. At this weightclass you should be able to squat 140-145 lbs.") else: squat > 320 print("You have fallen into the range of 320+ lbs. At this weightclass you should be able to squat around 150 lbs.") def bench(y): y = bench while bench < 165 and bench > 148: print("You have fallen into the range of 148-165 lbs. At this weightclass you should be able to bench 110-120 lbs.") if bench < 181 and bench > 166: print("You have fallen into the range of 166-181 lbs. At this weightclass you should be able to bench 110-120 lbs.") elif bench < 198 and bench > 182: print("You have fallen into the range of 182-198 lbs. At this weightclass you should be able to bench 120-125 lbs.") elif bench < 220 and bench > 198: print("You have fallen into the range of 198-220 lbs. At this weightclass you should be able to bench 125-130 lbs.") elif bench < 242 and bench > 221: print("You have fallen into the range of 221-242 lbs. At this weightclass you should be able to bench 130-135 lbs.") elif bench < 275 and bench > 243: print("You have fallen into the range of 243-275 lbs. At this weightclass you should be able to bench 135-140 lbs.") elif bench < 319 and bench > 275: print("You have fallen into the range of 243-275 lbs. At this weightclass you should be able to bench 140-145 lbs.") else: bench > 320 print("You have fallen into the range of 320+ lbs. At this weightclass you should be able to bench 150+ lbs.") print(squat(x), bench(y))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一个可能的问题可能是:
检查数字范围时,请确保您不会丢失任何数字。
例如,您检查“台式&lt; 242 and Bench&gt; 221”,以及“ Bench&lt; 220 and Bench&gt; 198”,但是如果板凳是220,该怎么办?尚未满足条件。
使用&gt; =比较可能是一个好主意,以确保您包括边界号。
因此,更改为:
确保所有数字都被解释。您必须为每个边界编号做同样的事情。
One possible problem could be:
When checking ranges of numbers, make sure that you are not missing any numbers.
For example, you check "bench < 242 and bench > 221", and "bench < 220 and bench > 198", but what if bench was 220? None of the conditions are met.
It might be a good idea to use >= comparisons to make sure you are including your boundary numbers.
so changing to :
would make sure that all the numbers are accounted for. You'll have to do the same for each boundary number.