0
What's wrong?
K = input("Enter the value of K" ) U =input("Enter the value of U " ) wave _number = float( 1303 * math.sqrt(float(K)/float(U))) print(float(wave_number)) What is the wrong I want to calculate the value of a law in physics. How can I do that with pythons?
5 Réponses
+ 4
First you need to import math. Then you have a space in wave _number. Then you don't need that many float conversions.
import math
K = input("Enter the value of K" )
U = input("Enter the value of U " )
wave_number = 1303 * math.sqrt(float(K)/float(U))
print(wave_number)
+ 4
Lol I was just looking at your code errors, not trying to decipher your code to attempt to have an understanding of which law of physics equation you're after! Could have been more specific to what you were actually after for an answer.
+ 1
Hooke's law
0
import math
Ϗ = input("Enter the value of Ϗ ")
µ = input("Enter the value of µ ")
wave_number = 1303 * math.sqrt(float(Ϗ) / float(µ))
print ( math.ceil ( wave_number ) )
a = wave_number
if 100 < a < 400:
print ( 'your wave_number in Far infrared region ' )
elif 400 < a < 4000:
print ( 'your wave_number in Mid infrared region ' )
elif 4000 < a < 13000:
print('your wave_number in Near infrared region ')
print('The functional group is ')