# Love Calculator In Python With Source Code

Last updated June 21, 2023 by Jarvis Silva

Want to find your love percentage between your partner using python then you are at the right place in this tutorial I will show you how to create love calculator in python with source code.

When I was in school students used to remove love percentage of a boy and a girl by using some calculations so I have decided to put it as a program.

## Python Code For Love Calculator

``````
print("Welcome to python love calculator program")

p1 = input("What is the name of person 1 : ")
p2 = input("What is the name of person 2: ")

len1 = (len(p1))
len2 = (len(p2))

len_p = 20 if len1 == len2 else 5
first_char = 50 if p1[0] == p2[0] else 5
last_char = 30 if p1[len1 - 1] == p2[len2 - 1] else 5

percentage =  len_p + first_char + last_char

```
```

Above is the code for calculating love percentage, this program calculates love percentage based on conditions like length, first and last character match of both the persons names, those are the conditions which I have added you can add more conditions if you want.

Now to run this program you need to have python installed on your computer, If you don’t have then follow this guide: Install and setup python on your computer or use this online python compiler.

After running this program you will see that it asks you to enter your and your partner name then according to the conditions it will calculate and print the percentage of your love, below is an example output.

``````
Welcome to python love calculator program
What is the name of person 1 : mary
What is the name of person 2: mario