Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

One day Shanto asked Saima how much she loves him. Saima's answer was 71.43%, which, unsurprisingly, shocked Shanto. Why didn't she say something like

image text in transcribed

One day Shanto asked Saima how much she loves him. Saima's answer was "71.43%", which, unsurprisingly, shocked Shanto. Why didn't she say something like "for the full 100% !", and why a particular and peculiar percentage like 71.43? Looking at Shanto's surprised, shocked and nervous face, she burst out laughing and told that she loves him more than any thing in this universe and it was nothing but a silly and funny love calculation. Then she described Shanto the calculation. There's a lot of online relationship advice, through answering quizzes, one's horoscope sign compatibility and whatnot. You are going to add yours, based on Saima's calculation. You will have to write a program so that any one can calculate love between any two persons very quickly. Rules: You will be given two names. These two names can have white space or some other non-alphabetical characters like $ & % etc. But only the alphabets from a to z or A to Z will participate in love calculation. Each alphabet has a particular value. The values are from 1 to 26 in ascending order of the alphabets. It's like this: a = 1, b = 2, c = 3, ..., z = 26. Both upper case and lower case holds the same values. Then make the sum of these numbers until it comes in one digit. For example, consider a name 'bcz'. Here, b = 2, c = 3 and z = 26. So, the sum is (2+3+26) = 31 = (3+1) = 4. Then the ratio of these two numbers in percentage will be the result. Remember: The result cannot be more than 100%, so make sure to take the ratio carefully to avoid this problem. Input Your input will be two names. Each name holds not more than 25 characters. End of file will indicate the end of input. Output For each pair of names, your program will have to calculate the love between those two persons' names and give the result as output. In the result, two digits are to be displayed after the decimal point. All the results must be on new lines. Sample input saima shanto Pakistan India USA USSR Sample output 71.43% 100.00 % 100.00 %

Step by Step Solution

3.40 Rating (156 Votes )

There are 3 Steps involved in it

Step: 1

Python program that takes two names as input c... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intermediate Accounting IFRS

Authors: Donald E. Kieso, Jerry J. Weygandt, Terry D. Warfield

3rd edition

1119372933, 978-1119372936

More Books

Students also viewed these Programming questions