frommathimport*'''
Prbolèmes dans cette version :
- Probablment des erreures de calculs
- Ne gère pas l'input d'une écriture scientifique
'''#Définition des constantes
c=3.0*10**8h=6.63*10**-35p=printdefMenu():globalchoixp("")p("Saisissez une grandeur :")p("1- Energie [eV] ")p("2- Energie [J] ")p("3- Longueur d'onde [nm]")p("4- Longueur d'onde [m]")p("5- Frequence [Hz]")p("6- Demo De Broglie")p("\n"*3)choix=int(input("Choix : "))result=eval("Menu{}()".format(choix))defMenu1():Eev=ask(1)p(""*2)p("Lamda(nm)= 1243 / E(ev)")p("lamda = {} nm".format(1243/Eev))p("Domaine",domaine((1243/Eev)*10**-9))p("")p("Frequence(Hz) =c / lambda(m)")fr=c/(1243/Eev)*10**-9p("Frequence={} Hz".format("%E"%fr))p(""*1)wait()defMenu2():Ej=ask(2)p("")p("Lamda(m)= h * c / E(J)")p("lamda (m)= {} m".format("%E"%(h*c/Ej)))lo=(h*c/Ej)*10**9p("lamda (nm) = {} nm".format("%E"%lo))p("Domaine",domaine(lo))p("")p("Frequence(Hz) = E(J) / h")fr=Ej/hp("Frequence = {} Hz".format("%E"%fr))p("")wait()defMenu3():Lnm=ask(3)p("Domaine",domaine(Lnm*10**-9))p(""*1)p("E(eV)= 1243 / lambda(nm)")p("E(eV) = {} eV".format(1243/Lnm))p("")p("Frequence(Hz) =c / lambda(m)")fr=c/Lnm*10**-9p("Frequence = {} Hz".format("%E"%fr))p(""*2)wait()defMenu4():Lm=ask(4)p("Domaine",domaine(Lm))p(""*1)p("E(J)= h*c / Lm")p("E(J) = {} J".format(h*c/Lm))p("")p("Frequence(Hz) =c / lambda(m)")fr=c/Lmp("Frequence = {} Hz".format("%E"%fr))p(""*2)wait()defMenu5():V=ask(5)p(""*2)p("E(J)= h*c / V")p("E(J) = {}J".format(h*c/V))p("")p("Lambda(m) =c / Frequence(Hz)")p("Lambda(m) = {} m".format(c/V))p("domaine",domaine(c/V))p("")wait()defMenu6():p("\n"*5)p("--Démo De Broglie--")p("\n")p(">soit 1.6*10^-15 coef J->ev\n")p(">E*1.6*10^-15=hc/lambda*10^-9\n")p(">E=hc/lambda*10^-9*1.6*10^-15\n")p(">E=1243/lambda")p("")wait()defwait():m=int(input("\t0-->quit, 1-->menu : "))ifm==0:passelse:Menu()defask(n):#A améliorer > détection de l'écriture scientifique
ifn==1:print("\n"*11)r=float(input("Energie en ev : "))elifn==2:print("\n"*11)r=float(input("Energie en J : "))elifn==3:print("\n"*11)r=float(input("Longueur d'onde en mm : "))elifn==4:print("\n"*11)r=float(input("Longueur d'onde en m : "))elifn==5:print("\n"*11)r=float(input("Frequence en Hz : "))returnrdefdomaine(m):ifm<10**-11:return"des rayons gamma"elifm>10**-11andm<10*10**-9:return"des rayons X"elifm>10*10**-9andm<400*10**-9:return"des ultraviolets"elifm>400*10**-9andm<800*10**-9:return"du visible"elifm>800*10**-9andm<1*10**-8:return"des mirco-ondes"else:return"des ondes radio"Menu()
During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:
Ensure the proper functioning of the site (essential cookies); and
Track your browsing to send you personalized communications if you have created a professional account on the site and can be contacted (audience measurement cookies).
With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.