Kribo

Bryting-NN-1

Aug 4th, 2020
198
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import numpy as np
  2.  
  3. def Uvi(sinv,n):
  4.     return((np.arcsin(sinv/n))*180/np.pi)
  5.  
  6. Ivi = float(input("Skriv inn innfallsvinkel i grader: "))
  7. sinv = np.sin(Ivi*np.pi/180)
  8.  
  9. Mvalg = float(input("Kva medium går lyset inn i (skriv inn talet)?\n 1-Vatn\n 2-Kronglas\n \
  10. 3-Flintglas\n 4-Diamant\n Ditt val: "))
  11.  
  12.  
  13. m1 = 1.333
  14. m2 = 1.55
  15. m3 = 1.7
  16. m4 = 2.287
  17.  
  18. if(Mvalg==1):
  19.     print("Brytingsvinkelen er",round(Uvi(sinv,m1),2),"grader.")
  20. elif(Mvalg==2):
  21.     print("Brytingsvinkelen er",round(Uvi(sinv,m2),2),"grader.")
  22. elif(Mvalg==3):
  23.     print("Brytingsvinkelen er",round(Uvi(sinv,m3),2),"grader.")
  24. elif(Mvalg==4):
  25.     print("Brytingsvinkelen er",round(Uvi(sinv,m4),2),"grader.")
  26. else:
  27.     print("Du skreiv inn noko ugyldig.")
RAW Paste Data