Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #%%
- #3
- a = float(input("Side 1 = "))
- b = float(input("Side 2 = "))
- c = float(input("Side 3 = "))
- if a>b>c or a>c>b:
- if a**2 == b**2 + c**2:
- print("Tallene er pytagoreiske tripler!")
- else:
- print("Tallene er ikke pytagoreiske tripler")
- elif b>a>c or b>c>a:
- if b**2 == a**2 + c**2:
- print("Tallene er pytagoreiske tripler!")
- else:
- print("Tallene er ikke pytagoreiske tripler")
- else:
- if c**2 == b**2 + a**2:
- print("Tallene er pytagoreiske tripler!")
- else:
- print("Tallene er ikke pytagoreiske tripler")
- #%%
- #4
- tall = int(input("Faktorisering av det naturlige tallet: "))
- print("Alle tall man kan dele " + str(tall) + " pƄ: ")
- print("1")
- for i in range(2, (tall + 2)//2):
- if tall%i == 0:
- print(i)
- print(tall)
- print("Primtallsfaktorene til " + str(tall))
- tall2 = tall
- j = 2
- while j <= tall2:
- if tall2 % j == 0:
- print(j)
- tall2 = tall2/j
- j = 2
- else:
- j = j+1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement