-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhomework-calc.py
More file actions
48 lines (35 loc) · 899 Bytes
/
homework-calc.py
File metadata and controls
48 lines (35 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
'''
A program I will mostly write while doing homework
'''
# imports
import math
# global vars
# physics constants
c = speedOfLight = 299792458 # m/s
h = plancksConstant = 6.62607004E-34 # m²kg/s
q = electronMass = 1.6021766208E-19 # Coloumb
# funcs
def nanoMetresToElectronVolt(nm):
# func would be used to convert nanometres into E-Photons
global q, h, c
print("Amount of nm: ", nm)
nm = nm * 1E-9
ePHinJoule = (h * (c/nm))
print(ePHinJoule, "Joule")
ePHinEV = (ePHinJoule / q)
print(ePHinEV, "eV")
def frequencyToJoule(f):
global h
ePHinJoule = (h*f)
return ePHinJoule
def convertJouleToeV(j):
global q
eV = j * q
return eV
# main-loop
def main():
#print(frequencyToJoule(900E3), "Joule")
#print(convertJouleToeV(frequencyToJoule(900E3)), " eV")
nanoMetresToElectronVolt(300)
# calling main
main()