Custom functions recommend a reasonable amount of sleep based on age. Python?

Updated on technology 2024-04-22
16 answers
  1. Anonymous users2024-02-08

    There's no reasonable amount of sleep, the parameters are all dead, can you let the computer know what you want to eat today? These are all extrapolated by big data. If it's homework, it's not that hard.

    def sleep(age):

    if age<10:

    return '8 hours'

    else:return '6 hours'

    How much sleep you want is up to the writer.

  2. Anonymous users2024-02-07

    This can be calculated using the piecewise function in Python.

  3. Anonymous users2024-02-06

    There are a lot of tables on the Internet to recommend a reasonable amount of sleep based on age, although I don't know if it's scientific.

  4. Anonymous users2024-02-05

    This sleep time is normally distributed.

  5. Anonymous users2024-02-04

    The function implementation should be okay to launch a reasonable sleep time based on age, no problem.

  6. Anonymous users2024-02-03

    Why do you need to design some formulas for these custom functions? As long as the whole framework is designed, and then some reasonable value intervals can be set into it.

  7. Anonymous users2024-02-02

    The custom function is implemented to recommend a reasonable sleep time according to your age, which is to recommend a sleep time that is most suitable for you according to some of your usual sleep habits.

  8. Anonymous users2024-02-01

    Yes, people sleep according to their age, people's sleep is not the same as their age, children need time to sleep, and adults don't need to sleep for so long.

  9. Anonymous users2024-01-31

    Why is the parameter not important, as long as it is called in the function statement block, it is time when it is used.

  10. Anonymous users2024-01-30

    Age = [(current year * 12 + current month * 1) - (year of birth * 12 + month of birth * 1)] 12

    Current Year - Year of Birth + (Current Month - Month of Birth) 12

  11. Anonymous users2024-01-29

    There are a few questions here.

    1.The line of the first line = This line is wasted. In other words, the first line in the text is not processed.

    There is a problem with this line, and a judgment should usually be added.

    if not :break

    Because, the last line of the text file readline, may be blank.

    Your net list[2] is caused by blank lines. So the result of split is 0 in length, empty column, and of course 2 is index out of range.

  12. Anonymous users2024-01-28

    Obviously something went wrong, you can debug what kind of content your new list is printed out; The reason for the error is that the index is longer than your list, 44 look' 'Double quotes are spaces in them, not spaces.

  13. Anonymous users2024-01-27

    Python's built-in module Time has a sleep function in seconds, or you can enter a decimal for milliseconds.

  14. Anonymous users2024-01-26

    Write a class. Leave a variable (fun2 tiime) in the class to record the timestamp of the execution of function 2.

    Write an infinite loop function in the class, constantly compare the difference in the current time of the variable (fun2 tiime), and execute function 2 if the difference is greater than 20

  15. Anonymous users2024-01-25

    The fun function has a logical error, so it is changed to:

    Note: Each = on the far left represents a space.

    def fun(m):

    ==for i in range(2,m):

    *****=if m%i==0:

    **********return false====return true

  16. Anonymous users2024-01-24

    You send out the results, isn't it stupid.

Related questions
14 answers2024-04-22

private sub command1_click()dim i as integer

dim sum as long >>>More

13 answers2024-04-22

Look it up and read Zheng Shen's "BC High Cluster Chain Accuracy Respect Function Library". >>>More

8 answers2024-04-22

Clause. 1. Use graphics software (such as CorelDraw) to make the materials required for dynamic expressions, and export them to jpg format (you can also use the existing ** to combine them yourself). In Photoshop, remove the ** and put it in a folder in order of dynamic expression changes. >>>More

5 answers2024-04-22

#include

#define m 5 >>>More

12 answers2024-04-22

The first way: Replace Samsung i9000 system sound files.

Eliminate the sound of taking pictures with your own camera. >>>More