Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can someone help me code this in python? def get_bday_compatibility(bday1: str, bday2: str) -> int: ''' Given two strings representing birthdates in the format DD-MM-YYYY,

can someone help me code this in python?

def get_bday_compatibility(bday1: str, bday2: str) -> int: ''' Given two strings representing birthdates in the format DD-MM-YYYY, figure out what star sign each birthdate belongs to and return the astrological compatibility of the two signs.

NOTE FROM BOB: This code should look similar in structure to the get_name_compatibility function that I already finished. That is, it should call on other functions for help, and not be more than a couple of lines long in total.

>>> get_bday_compatibility('30-08-1998', '01-09-1998') 100 >>> get_bday_compatibility('30-08-1998', '08-12-1978') 50 '''

pass

the code i used for get_name_compatibility.

def get_name_compatibility(name1: str, name2: str) -> int: ''' Given two strings, return their name compatibility.

NOTE FROM BOB: According to Bob's rules, this should be calculated by checking how many letters in the first name occurs in the second, and adding this to how many letters in the second name occurs in the first, and then multiplying this sum by 11 if either all the letters in the first name occur in their original order within the second name or vice versa. If neither names occur within the other, multiply by 10 instead. For example: If the names are BOB Y and BOBBETTE Z, then - for BOB Y, we get the number 3, because 3 letters in this name occur in the other - for BOBBETTE Z, we get the number 4, because 4 letters in this name occur in the other. The number returned for these two names should be 3 + 4 = 7, and since neither of the names occur entirely within the other, (the function occurs_within would return False, since there is no Y in "BOBBETTE Z" and no E,T nor Z in "BOB Y"), we multiply by 10 = 70.

>>> get_name_compatibility('bob y', 'bobbette z') 70

>>> get_name_compatibility('sadia sharmin', 'ryan gosling') 150 '''

if occurs_within(name1, name2) or occurs_within(name2, name1): multiplier = 11 else: multiplier = 10

return (count_common_occurrences(name1, name2) + \ count_common_occurrences(name2, name1)) * multiplier

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Students also viewed these Databases questions

Question

recognise typical interviewer errors and explain how to avoid them

Answered: 1 week ago

Question

identify and evaluate a range of recruitment and selection methods

Answered: 1 week ago

Question

understand the role of competencies and a competency framework

Answered: 1 week ago