# Oppgave 1 navn1 = input("Navn på person 1: ") navn2 = input("Navn på person 2: ") # Konverter navnene til små bokstaver navn1 = navn1.lower() navn2 = navn2.lower() match = 0 # Sjekk om navnene er like lange if len(navn1) == len(navn2): match = 60 # begynner de med samme forbokstav? elif navn1[0] == navn2[0]: match = 40 else: match = 15 # Oppgave 2 bosted1 = input("Bosted til person 1: ") bosted2 = input("BOsted til person 2: ") if bosted1 == bosted2: match = match * 1.5 alder1 = int(input("Alder til person 1: ")) alder2 = int(input("Alder til person 2: ")) if alder1 < alder2 / 2 + 7 or alder2 < alder1 / 2 + 7: match = match / 2 elif alder1 == alder2: match = match * 1.1 # Oppgave 3 if "a" in navn1 or "t" in navn1 or "a" in navn2 or "t" in navn2: match = match + 2 if ("s" in navn1 and "e" in navn1 and "e" not in navn2) or ("s" in navn2 and "e" in navn2 and "e" not in navn1): match = match + 15 if navn1[0] not in navn2: match = match - 20 if navn1[-1] == navn2[0] or navn2[-1] == navn1[0]: match = match + 30 if len(navn1) == 1 or len(navn2) == 1: match = 0 match = round(match) if match > 100: match = 100 elif match < 0: match = 0 print("Match mellom ", navn1, "og", navn2, "er", match, "%")