**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 downloadingthis Jupyter notebookto your local...

1 answer below »

**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 downloadingthis Jupyter notebookto your local machine.


2 - Open a tab in your browser and typehttps://colab.research.google.com/.


3 - This will open a small window. Choose the last optionShow notebooks in Driveon 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 theexamples 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.


Answered 1 days AfterOct 16, 2021

Answer To: **Important note: **We suggest that you use Colab to work on the Jupyter notebook that you will...

Sathishkumar answered on Oct 17 2021
113 Votes
from datetime import datetime, timedelta
# datetime object containing current date and time
now
= datetime.now()
print("now =", now)
# dd/mm/YY H:M:S
dt_string = now.strftime("%H:%M:%S")
print( dt_string)    
#Small Description about the code
print('Hello User!.The current time is :',dt_string)
print('------------------------------------------------')
print('------------------------------------------------')
print('You have five sleeping life cycle every day!')
print('------------------------------------------------')
print('------------------------------------------------')
print('''select mode to know about life cycles:
1--To know about Wake up time
2--To know about start of sleep time
''')
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here