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?

17th Apr 2020, 10:50 PM
Mostafa Mahmoud
Mostafa Mahmoud - avatar
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)
17th Apr 2020, 11:11 PM
ChaoticDawg
ChaoticDawg - avatar
+ 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.
17th Apr 2020, 11:27 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Hooke's law
17th Apr 2020, 11:21 PM
Mostafa Mahmoud
Mostafa Mahmoud - avatar
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 ')
21st Apr 2020, 12:40 PM
Mostafa Mahmoud
Mostafa Mahmoud - avatar