태지쌤

로봇 & 코딩교육 No.1 크리에이터

파이썬/exercise

3-3 python love calulator

태지쌤 2022. 12. 27. 05:21
반응형
print("Welcome to the Love Calculator!")
name1 = input("What is your name? \n").lower()
name2 = input("What is their name? \n").lower()
t = name1.count('t')
r = name1.count('r')
u = name1.count('u')
e = name1.count('e')
t2 = name2.count('t')
r2 = name2.count('r')
u2 = name2.count('u')
e2 = name2.count('e')
true = t + r + u + e + t2 + r2 + u2 + e2

l = name1.count('l')
o = name1.count('o')
v = name1.count('v')
e = name1.count('e')
l2 = name2.count('l')
o2 = name2.count('o')
v2 = name2.count('v')
e2 = name2.count('e')
love = l + o + v + e + l2 + o2 + v2 + e2

score = true * 10 + love

if score < 10 or score > 90:
    print(f"Your score is {score}, you go together like coke and mentos.")
elif 40 <= score <= 50:
    print(f"Your score is {score}, you are alright together.")
else:
    print(f"Your score is {score}")
반응형

'파이썬 > exercise' 카테고리의 다른 글

4-1. python random module, 동전 앞 뒤 무작위  (0) 2023.01.03
3-4 python treasure island  (0) 2022.12.27
3-2 python Pizza calculator  (0) 2022.12.27
2-3 python tip calculator  (0) 2022.12.27
2-2 python 남은 삶 계산  (0) 2022.12.27