## Software Design and Implementation

#### A9: Life Path Numbers

Assignment A9 should be complete individually.

In this assignment, students will gain practice in creating and using a fruitful function which employs integer division and modulus.

#### A9: Life Path

A key idea in this assignment is to use fruitful functions for returning values. Note that when a function returns a value, it is typical to put the value into a variable or used directly. The following examples illustrate both of these ideas:
Numerologists consider the Life Path Number to be the most important number in one's numerology chart.
Another important type of number is the Master Number. Master numbers are multiples of 11 such as 11, 22, or 33.

The Life Path Number is a number which is derived from the sum total of the digits that make up your birth date with a couple of exceptions. The exceptions occur with master numbers such as the month of November which is the 11th month or birthdays on the 11th or 22nd, or sum totals of 11 or 22 or 33. Master numbers are not converted to single digits in the process of computing a Life Path number.

• Step 1: month: Convert the number of the birth month to digits and sum them unless the month is November, in which case it is left as an 11.
• Step 2: day: Convert the birthday day to digits and sum these unless the day is the 11th or the 22nd, in which case the 11 and 22 are left as an 11 or a 22.
• Step 3: year: Convert the year to 4 digits, and sum the four digits.
• Step 4: Sum: Add all these digits together from Steps 1, 2, and 3. Reduce this total sum further by adding the remaining digits together until a single digit or a Master Number is obtained.
Example birthday of October 11, 1975 => Life Path Number 7
• Step 1: month: Convert the number of the birth month to digits and sum them unless the month is November, in which case it is left as an 11: October = 10 => 1 + 0 = 1.
• Step 2: day: Convert the birthday day to digits and sum these unless the day is the 11th or the 22nd, in which case the 11 and 22 is left as an 11 or a 22. 11 is a master number, so it is not reduced.
• Step 3: Convert the year to 4 digits, and sum the four digits. 1975 => 1+9+7+5 = 22.
• Step 4: Sum all these digits together from Steps 1, 2, and 3. Reduce this total sum further by adding the remaining digits together until a single digit is obtained. 1+ 11 + 22 = 34. Then 3 + 4 = 7 is the life path number.
Example birthday of December 31, 1981 => Life Path Number 8
• Step 1: month: Convert the number of the birth month to digits and sum them unless the month is November, in which case it is left as an 11: December = 12 => 1 + 2 = 3.
• Step 2: day: Convert the birthday day to digits and sum these unless the day is the 11th or the 22nd, in which case the 11 and 22 is left as an 11 or a 22. 31 => 3 + 1 = 4
• Step 3: Convert the year to 4 digits, and sum the four digits. 1981 => 1+ 9 + 8 + 1 = 19
• Step 4: Sum all these digits together from Steps 1, 2, and 3. If the sum of these digits is a master number (11 or 22 or 33), return that number. Unless you get a master number, reduce this total sum further by adding the remaining digits together until a single digit is obtained. 3 + 4 + 19 = 26 => 2 + 6 = 8 is the life path number.
Example birthday of January 3, 2005 => Life Path Number 11
• Step 1: month: Convert the number of the birth month to digits and sum them unless the month is November, in which case it is left as an 11: January = 1 => 1
• Step 2: day: Convert the birthday day to digits and sum these unless the day is the 11th or the 22nd, in which case the 11 and 22 is left as an 11 or a 22. 3 => 3
• Step 3: Convert the year to 4 digits, and sum the four digits. 2005 => 2 + 0 + 0 +5 = 7
• Step 4: Sum all these digits together from Steps 1, 2, and 3. If the sum of these digits is a master number (11 or 22 or 33), return that number. Unless you get a master number, reduce this total sum further by adding the remaining digits together until a single digit is obtained. 1 + 3 + 7 = 11 => 11 is a Master Number so it is not reduced. It is the Life Path Number.
For an online Life Path Calculator see http://seventhlifepath.com/. You can use this to check your computations.

#### Modulus (Remainder) operator

The modulus operator, indicated by the percent symbol (%), calculates the remainder after dividing the number to the left with the number to the right. For example,

10 % 3 = 1

because 3 divides into 10 three times and leaves one as a remainder. If you were to take integer division and the modulus operators together, you can undo division to get the original number back:
10 % 3 = 1
10 // 3 = 3
(3 * 3) + 1 = 10
You may find the following programs useful to your understanding of the modulus operator:
• is_even.py uses modulus to determine whether or not a number is even.
• p-making-change.py is an example that demonstrates how to use modulus and integer division to make coin change for a certain amount of money.

#### The instructions

This assignment should be completed individually. Create a program named yourusername-A9.py.

In your program create at least one fruitful function which does the following computation:
• Takes a single integer as an input parameter.
• Use modulus (%) to determine if the input is a multiple of 11 (i.e. 11 or 22 or 33). If it is and is 33 or less, the input is a master number so simply return the master number.
• If the input is not a master number, convert the input to digits and return the sum of the digits.
• Begin with a triple quoted docstring describing what arguments our function takes, what it does, and what the expected result is. It need not be long, but it should have enough info to be able to use the function without having to look at the code.
• uses functions for encapsulation with triple-quoted docstring for each of these functions. This docstring must include a description of the main purpose of the function, and descriptions of all input parameters as well as what is returned by the function.
• Asks the user to input their birthday. You probably want to use three separate prompts for month, day, and year.
• Uses a type conversion from string to integer for each of these.
• Calls the fruitful function described above with inputs of month, day, and year. Then calls it again to sum the digits.
• Makes use of the modulus function in determining if a number is a Master Number.
• Does something creative and interesting while informing the user of their Life Path Number. This might be a graphical display of the Life Path Number and/or a description of the numerological meaning of that particular number.
• Be sure to include our standard header at the top of your program with name, username, assignment number, purpose and acknowledgements.
• Includes a main() function.
• The highest level of your program (i.e., no indenting) should only contain the following: