CP103: Assignment 01 - Winter 2025

Due 8:30 AM, Monday, January 27, 2025

Tasks

Create a project folder username_a01. Place all your tasks python files(t01.py , t02.py ,t03.py) and the testing file testing.txt inside this folder. Upon completing your tasks, export your projrct folder to username_a01.zip file, validate it, and submit it to the dropbox by the due date.

  1. Write and test a Python module named . Copy your testing to testing.txt.

    This program demonstrates your understanding of the use of single, double and triple quotes by using four (4) print functions to print the following four sets of text:

    • The book title is, "Learn Python in 21 Days".
    • What's mine is mine, and what's yours is mine.
    • "You have enemies? Good. That means you've stood up for something, sometime in your life." Winston Churchill
    • Three things cannot be long hidden:
      the sun,
      the moon,
      and the truth.

    The program may use only one print function per piece of text. Use no other print functions in your program - no titles or blank lines. The program must include one use of each of the following around the text in the print function:

    • single quotes (')
    • double quotes (")
    • triple single quotes (''')
    • triple double quotes (""")

    The program may not use any escape characters in its text, i.e it may not use \n or quote escaping: \" or \'.

    Partial testing:


    Results


  2. Write and test a PyDev module named . Copy your testing to testing.txt.

    This program asks the user for a length in inches and prints the equivalent length in metres. Use 0.0254 as the conversion factor from inches to m.

    Sample execution:

    Length in inches: 68
    
    Length in m: 1.7271999999999998
    

    Run the program with three different sets of inputs.

    Partial testing:


    Results


  3. Write and test a PyDev module named . Copy your testing to testing.txt.

    This program calculates and prints compound interest. Compound interest is calculated by:

    \( A = P \left(1 + \frac{r}{n} \right)^{nt} \)

    where \(P\) is the principal amount, \(r\) is the annual rate of interest (as a decimal), \(t\) is the number of years the amount is deposited or borrowed for, \(n\) is the number of times the interest is compounded per year, and the result \(A\) is the amount of money accumulated after \(t\) years.

    Sample execution:

    Principal: $5000.00
    Interest: 5.0
    Number of years: 10
    Number of times interest compounded per year: 12
    
    Balance: $ 8235.0474884514

    Run the program with three different sets of inputs.

    Partial testing:


    Results


Partial testing of testing.txt:


Results