Sep-30-2019, 06:06 PM
(This post was last modified: Sep-30-2019, 06:10 PM by ichabod801.)
Im pretty new at programming, but atm im trying to make a function that takes two user inputs and use the input on previously made functions.
I only need help with the last part (part 4).
(BTW some of the words are in norwegian so here are some translated word to make it easier to understand if you need it): addisjon - addition, tall - number, subtraksjon - subtraction, divisjon - division, retur - return, verdi - value, tommer - inches, beregninger - calculations, Skriv inn - write.
THANK YOU IN ADVICE!
I only need help with the last part (part 4).
(BTW some of the words are in norwegian so here are some translated word to make it easier to understand if you need it): addisjon - addition, tall - number, subtraksjon - subtraction, divisjon - division, retur - return, verdi - value, tommer - inches, beregninger - calculations, Skriv inn - write.
THANK YOU IN ADVICE!
""" 1""" def addisjon (tall1, tall2): return tall1 + tall2 returverdi = addisjon (5, 5) assert addisjon (5,5)==10 assert addisjon (-10, -10)==-20 assert addisjon (-7, 10)==3 print (returverdi) """ 2 """ def subtraksjon (tall1, tall2): return tall1 - tall2 returverdi = subtraksjon (15, 6) assert subtraksjon (15,15)==-0 assert subtraksjon (-30, 20)==-50 assert subtraksjon (-20, -10)==-10 print (returverdi) def divisjon (tall1, tall2): return tall1 / tall2 returverdi = divisjon (50, 5) assert divisjon (30, 2)==15 assert divisjon (-50, 3)==-16.666666666666668 assert divisjon (-30, -6)==5 print (returverdi) """ 3 """ def tommerTilCm (antallTommer): assert antallTommer > 0 return antallTommer * (2.54) returverdi = tommerTilCm (12) print (returverdi), "Cm" """ 4 """ def skrivBeregninger(): a=input ("Skriv inn tall 1: ") b=input ("Skriv inn tall 2: ") for a and b in skrivBeregninger(): print (addisjon) print (subtraksjon) print (divisjon) print (skrivBeregninger())