Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
function help
#3
Let's look at your code line by line.

First, you define a function, minute_ that takes one parameter, presumably numeric. OK, though better if you use a more descriptive name than x

Next you declare a variable, m, as being equal to the return value from another function called second(). The function second() takes no parameters but returns (hopefully) a numeric value. This is then multiplied by 60 before being stored in m. I would point out that typically you would divide the number of seconds by 60 to get the number of minutes, but perhaps that is not what you are doing.

minute is then calculated by taking the passed value x and multiplying by another call to the function second(), whatever that returns.

min_as_second is then given the value of m (which is 60 * that call to second) multiplied by yet another call to second.

Note that if second() returns different values depending on the current time or the like, you may get different results from your 3 calls to the function second().

You then return that value.

I suspect you have logic errors, as this is not what you want. Perhaps I am wrong. What does the function second() do, and what does it return?
Reply


Messages In This Thread
function help - by Nickd12 - Nov-06-2020, 09:39 PM
RE: function help - by Gribouillis - Nov-06-2020, 09:56 PM
RE: function help - by jefsummers - Nov-07-2020, 07:35 PM
RE: function help - by Nickd12 - Nov-08-2020, 01:44 AM
RE: function help - by bowlofred - Nov-08-2020, 04:23 AM
RE: function help - by Gribouillis - Nov-08-2020, 07:32 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020