Programming Research Assignment Help

This assignment is worth 15% of your final grade.

**Important note: **We suggest that you use Colab to work on the Jupyter notebook that you will submit as your final project on Forum:

1 – Start by downloading this Jupyter notebook to your local machine.

2 – Open a tab in your browser and type https://colab.research.google.com/.

3 – This will open a small window. Choose the last option Show notebooks in Drive on the upper menu, “Upload”. Then choose the Jupyter notebook you have saved in step 1.

4 – You can start working on your assignment by answering the questions in the corresponding cells.

5 – If you have any questions, please reach out to your instructors and TAs.

Overview

Your life might be a little bit busy and your day might be full of tasks that usually affect your sleeping quality. Sometimes, when your alarm rings, you feel like you are very tired when you’ve had an insufficient amount of sleep. This usually happens not only because of a few sleep hours but also because of irregularities in the sleeping time and waking time schedule.

Human sleeping consists of typically four to five sleep cycles, each lasting for about 90 minutes. The best time for waking up is after the sleeping cycle, not during. In this assignment, you will use algorithmic thinking to build a tool that can make your sleeping better by telling you when exactly to sleep and wake up depending on existing sleeping cycle guidelines.

You will write a description of the algorithmic process by which you will solve this problem, then you will implement your solution in well-documented Python code. You will receive holistic, formative feedback on the LOs applications indicated between square brackets.

1 – Algorithm Description

You should devise an algorithm that does the following :

  • Tells you about the best time to wake up if you are going to sleep now.
  • Tells you about the best time to sleep if you want to wake up at a specific time.

The algorithm should be based on the following assumptions:

  • Human sleeping is composed of a number of “sleeping cycles”.
  • Humans need 15 minutes to sleep and start the first cycle.
  • Between every two cycles, there is a 15 minutes gap which is the best time for a person to wake up refreshed.
  • A person needs at least 4 sleeping cycles every day.

Feel free to add more assumptions to improve the algorithm but make sure to explain your assumptions in detail to a non-technical audience.

Algorithmic Description Task [#algorithmicstrategies, #computationaltools]

  • Describe the input(s), output(s) and the process of the algorithm.
  • Draw a flowchart to show the process of the algorithm.

NOTE: To import a picture, for example, “image.png” to your Jupyter notebook, you can use the following block of code from IPython.display import ImageImage(“my_image.png”)

  • Explain in detail how this process is an “algorithm”.

2 – Implementation

Write a Python implementation of your algorithm. Feel free to use whatever form of input or output you think works best as long as it fulfills the assignment requirements. For example, your Python program can take as input the current time and then can offer two options for the users:

  • The best time to wake up if you are going to sleep now. This will be the best time to wake up based on the assumptions mentioned above.
  • The best time to sleep if you want to wake up at a specific time. In this case, the code should take the desired time to wake up and based on it, it should calculate the best time to sleep based on the assumption given above.

Implementation Task [#algorithmicstrategies, #computationaltools, #compprogramdesign, #quantcommunication]

  • Provide a well-commented Python code that follows the above instructions.
  • You should use the following Python elements at a minimum, but feel free to use additional ones:
    • Functions
    • User input
    • Variables
    • Operators
  • Be sure to comment thoroughly so that it is clear that you understand what every line of the code is intended to accomplish.
  • Make sure to include a few test-cases to make sure your code works. Include your test cases in your submission. Explain how you used these test cases in your comments. Please consult the examples under “Unit Tests vs. Integration Tests” for how to use assert statements in Python to test the correctness of your code.
  • Pro tip: it could be useful for testing and for code readability to make several separate functions for each sub-task, and call them inside the main function.

Optional Challenges:

1 – Including Python Modules— Python modules are a very powerful feature, typically optimized in Python, and using them can save the effort of writing some lines of codes. Look up the different Python time modules available online and choose one to improve your implementation above so that the user doesn’t have to enter the current time [#compprogramdesign, #quantcommunication].

Hint: Check out the datetime module, as it is a great tool to take time as input and perform calculations with it. See the documentation page, and this practical guide to adding and subtracting dates and times. As a general tip, if you are confused with the documentation, google what you want to do and use Stack Overflow and similar websites as a source of examples.

2 – Translating Time Zones— Sometimes, you might have a meeting with someone who is situated in another country or region which has a different time zone. The night before your meeting, it’s sometimes confusing to convert their time zone to yours and it will be even more confusing to decide when to sleep and when to wake up to have sufficient sleeping cycles. Search and find any Python module available online that can convert time zones and use it to improve your implementation so that you can enter your time zone, the meeting in the other time zone and then the function should tell you when to wake up to catch the meeting and have good sleep at the same time [#compprogramdesign, #quantcommunication].

3 – Lucky Sleep — You are a very superstitious person, and you know from the wisdom of numerology that going to sleep or waking up at times related to the number 13 gives you bad luck. Include a feature in your program that checks if the sum of any two digits is equal to 13 in either the time to wake up or the time to go to sleep. Print an alert if that happens [_#compprogramdesign, #quantcommunication_].

Your assignment submission needs to include the following resources:

  1. A .pdf file must be the first resource and it will include all the answers to the questions above, including all the python code you produce. Make sure that you submit a neat, clearly presented, and easy-to-read .pdf. The .pdf should be submitted under the name file “student_name.pdf”.
  2. Your second resource must be a single Jupyter Notebook with extension .ipynb (please see Figure below) and named “student_name.ipynb”.
A screenshot of a computer

Description automatically generated with medium confidence

Assignment Information

Weight:

15%

Learning Outcomes Added

  • algorithmicstrategies: Demonstrate the ability to think logically and systematically about problems, breaking them down into a clear, ordered set of concrete steps that could be implemented by a machine.
  • computationaltools: Apply the computational terminology and tools appropriately in different quantitative contexts.
  • compprogramdesign: Generate working programs in a computer language that can solve computational problems; find and fix bugs that appear in them.
  • quantcommunication: Communicate with a clear and precise style that is suited to an appropriate audience. Produce code that can be easily read and understood by others.
 

Leave a Reply