So I am new to programming and am currently trying to make a program to calculate the amount of photons that are emitted from a metal by a specific wavelenght or frequency (photoelectric effect). The program is meant to use calculations with the frequency of an electromagnetic wave, which is why I am trying to define a function that, through simple division with c/λ, can calculate the frquency. However, when I tried to do this, Python gave me and answer that was off by 10^1. Why does this happen? The inserted values are supposed to be correct, and even my programming teacher couldn't find any mistake in the code.
Here's my code, by the way. I made this in a test file which I am planning on copying to my main .py document:
a = 550 #nm
c = 299792458 #m/s
b = a*(10**-9) #meter
print(b)
print(c)
d = c/b
print(d)
And this is the output that I get (the actual frequency should be around 54 077 200 000 000 (calculated on Google Calculator):
5.5e-07
299792458.0
545 077 196 363 636.3
As you can se, the answer is off by 10^1. How do I fix this?