Python Forum
Love Calculator - If and Else
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Love Calculator - If and Else
#1
I am making a love calculator using python. I am going to use a points based system to calculate the 'Love Percentage' So I have a list of criteria;
Both first names have the same character length.[+20]
Both first names start with a vowel.[+10]
Both first names start with a consonant [+5]
Both names have the same number of vowels [+12]
Both names have the same number of consonants [+12]

I dont need answers to all of them all I need is help to work out first names that start with vowels and then I was thinking of putting the consonants in a else and vowels in a if? However my code keeps saying that the string has vowels when it does not? 
here is my code so far...

POINTS = 0
CON = 0
VOL = 0
print ("Welcome to the love calculator")
Love1 = input("Please enter the first persons name\n")
Love2 = input("Please enter the second persons name\n")

L1 = (len(Love1))
L2 = (len(Love2))

S1 = (Love1[:1])
S2 = (Love2[:1])

if L1 == L2:
    POINTS = POINTS + 20

if S1 == "a" or "e" or "i" or "o" or "u":
    POINTS = POINTS + 5
else:
    POINTS = POINTS + 2.5
if S2 == "a" or "e" or "i" or "o" or "u":
    POINTS = POINTS + 5
else:
    POINTS = POINTS + 2.5

print (POINTS)
Reply
#2
see http://python-forum.io/Thread-Multiple-e...or-keyword
Reply
#3
Oh thank you, I literally spent two hours of my lesson today trying to work it out and i only needed brackets :)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  This project a little over my head, would love some help. michoff 3 3,439 Feb-02-2018, 07:01 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020