저는 여기 새로 왔으며 파이썬 프로그래밍에 익숙해졌습니다. 웹을 통해 유용한 답변을 찾고 있었지만 문제에 대한 해결책을 찾는 것은 불가능했습니다. 여기오류 파이썬 : 부동 소수점이 필요합니다.
은 간다 :
radiation=1.3888
n=17
LAT=51.05
def dec(n):
if 0<n<365:
dec=23.45*math.sin(math.radians(360*(284+n)/365))
print(dec)
else:
print('the day',n,'is not valid')
def wss(LAT,dec):
wss=math.degrees(math.acos(((math.tan(math.radians(LAT)))*math.tan(math.radians(dec)))))
print(wss)
---이 코드를 실행하면 이것은 내가받을 것을 : 파이썬은 나에게 이러한 유형의 오류를주는 이유
>>> dec(n)
-20.91696257447642
>>> wss(LAT,dec)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:/Users/Gerard/Dropbox/Master Thesis Gerard Pujol/Master Thesis Work/work hourly radiation OK.py", line 25, in wss
wss=math.degrees(math.acos(-((math.tan(math.radians(LAT)))*math.tan(math.radians(dec)))))
TypeError: a float is required
나도 몰라 : '부유물이 필요합니다'.
많은 수정을 시도했지만 쓸모가 없었습니다. 누군가 내 문제를 해결하기를 바랍니다. 고마워요!
코드의 형식을 수정하십시오 –
(코드 블록에 코드를 넣었지만 잘못 들여 쓰기가되었습니다) – geoffspear
'math.radians (dec)'; 'dec'은 함수가 아니라 값입니다. 어쩌면 당신은'dec (something) '을 부를까? – geoffspear