-
Notifications
You must be signed in to change notification settings - Fork 0
/
Love Calc (100 DoC) Original.py
60 lines (50 loc) · 2.56 KB
/
Love Calc (100 DoC) Original.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
### SHORT CODE ###
# Collect data input
print("Welcome to the Love Calculator!")
name1 = input("What is your name? \n")
name2 = input("What is their name? \n")
# Convert the input into lowercase as a fail tolerance measure
lowername1 = name1.lower()
lowername2 = name2.lower()
# Count the number of occurances for the letters "l-o-v-e" and "t-r-u-e" within the two names - I chose a for loop to do this.
for letters in lowername1:
truecountn1 = lowername1.count("t") + lowername1.count("r") + lowername1.count("u") + lowername1.count("e")
lovecountn1 = lowername1.count("l") + lowername1.count("o") + lowername1.count("v") + lowername1.count("e")
for letters in lowername2:
truecountn2 = lowername2.count("t") + lowername2.count("r") + lowername2.count("u") + lowername2.count("e")
lovecountn2 = lowername2.count("l") + lowername2.count("o") + lowername2.count("v") + lowername2.count("e")
# Combine the number of 't-r-u-e" and "l-o-v-e" occurances as a true love number
tc = str(truecountn1 + truecountn2)
lc = str(lovecountn1 + lovecountn2)
lovecalc = tc + lc
# Return the calculations with range-based score statements
if int(lovecalc) < 10 or int(lovecalc) > 90:
print(f"Your score is {lovecalc}, you go together like coke and mentos.")
elif int(lovecalc) >= 40 and int(lovecalc) <= 50:
print(f"Your score is {lovecalc}, you are alright together.")
else:
print(f"your score is {lovecalc}")
### LONG CODE ###
# 🚨 Don't change the code below 👇
print("Welcome to the Love Calculator!")
name1 = input("What is your name? \n")
name2 = input("What is their name? \n")
# 🚨 Don't change the code above 👆
#Write your code below this line 👇
lowername1 = name1.lower()
lowername2 = name2.lower()
for letters in lowername1:
truecountn1 = lowername1.count("t") + lowername1.count("r") + lowername1.count("u") + lowername1.count("e")
lovecountn1 = lowername1.count("l") + lowername1.count("o") + lowername1.count("v") + lowername1.count("e")
for letters in lowername2:
truecountn2 = lowername2.count("t") + lowername2.count("r") + lowername2.count("u") + lowername2.count("e")
lovecountn2 = lowername2.count("l") + lowername2.count("o") + lowername2.count("v") + lowername2.count("e")
tc = str(truecountn1 + truecountn2)
lc = str(lovecountn1 + lovecountn2)
lovecalc = tc + lc
if int(lovecalc) < 10 or int(lovecalc) > 90:
print(f"Your score is {lovecalc}, you go together like coke and mentos.")
elif int(lovecalc) >= 40 and int(lovecalc) <= 50:
print(f"Your score is {lovecalc}, you are alright together.")
else:
print(f"your score is {lovecalc}")