SHARE
TWEET

3 og 4, 37-38

Magnus_Engstroem Sep 18th, 2019 (edited) 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #%%
  2. #3
  3. a = float(input("Side 1 = "))
  4. b = float(input("Side 2 = "))
  5. c = float(input("Side 3 = "))
  6.  
  7. if a>b>c or a>c>b:
  8.     if a**2 == b**2 + c**2:
  9.         print("Tallene er pytagoreiske tripler!")
  10.     else:
  11.         print("Tallene er ikke pytagoreiske tripler")
  12. elif b>a>c or b>c>a:
  13.     if b**2 == a**2 + c**2:
  14.         print("Tallene er pytagoreiske tripler!")
  15.     else:
  16.         print("Tallene er ikke pytagoreiske tripler")
  17. else:
  18.     if c**2 == b**2 + a**2:
  19.         print("Tallene er pytagoreiske tripler!")
  20.     else:
  21.         print("Tallene er ikke pytagoreiske tripler")
  22.  
  23. #%%      
  24. #4
  25. tall = int(input("Faktorisering av det naturlige tallet: "))
  26.  
  27. print("Alle tall man kan dele " + str(tall) + " på: ")
  28. print("1")
  29. for i in range(2, (tall + 2)//2):
  30.     if tall%i == 0:
  31.         print(i)
  32. print(tall)
  33.  
  34. print("Primtallsfaktorene til " + str(tall))
  35. tall2 = tall
  36. j = 2
  37. while j <= tall2:
  38.     if tall2 % j == 0:
  39.         print(j)
  40.         tall2 = tall2/j
  41.         j = 2
  42.     else:
  43.         j = j+1
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top