首页 > 解决方案 > 学习python卡在项目上

问题描述

我是自学编程(python) 我给了自己一个项目来编写 Beaufort 量表。我这样做了,见下文,但每次我输入风速时,我都会得到所有可能的答案,而不是我编程给我的答案。谁能告诉我我的方式错误。

wind_speed = (input("What is the wind speed? "))

if wind_speed <= "3":
print("light airs drifting conditions")
if wind_speed > "3" <= '6':
print("Light breeze, sail: full sail and large genoa.")
if wind_speed > "7" <= "10":
print("Gentle breeze, sail: full sail")
if wind_speed > "11" <= "16":
print("Moderate, Sail: reduce headsail size")
if wind_speed > "17" <= '21':
print("Fresh breeze,sail: reef mainsail")
if wind_speed > '22' <= '27':
print("Strong breeze,sail:reef main sail and reduce headsail")
if wind_speed > '28' <= '33':
print("Near gale, sail: deep reefed main sail, small jib")
if wind_speed > '34' <= '40':
print("Gale, sail: deep reefed main, small jib")
if wind_speed > '41' <= '47':
print("Severe gale, sail: trysail and storm jib")
if wind_speed > '48' <= '55':
print("Storm,survival conditions")
else:
print("SKillz")

标签: python

解决方案


推荐阅读