• Sign Up
    Time to claim your honor
  • Training
  • Practice
    Complete challenging Kata to earn honor and ranks. Re-train to hone technique
  • Freestyle Sparring
    Take turns remixing and refactoring others code through Kumite
  • Community
  • Leaderboards
    Achieve honor and move up the global leaderboards
  • Chat
    Join our Discord server and chat with your fellow code warriors
  • Discussions
    View our Github Discussions board to discuss general Codewars topics
  • About
  • Docs
    Learn about all of the different aspects of Codewars
  • Blog
    Read the latest news from Codewars and the community
  • Log In
  • Sign Up
JacobBHartman Avatar
Name:Unknown
Clan:Holberton School
Member Since:Dec 2017
Last Seen:Dec 2020
Profiles:
Following:68
Followers:69
Allies:68
View Profile Badges
  • Stats
  • Kata
  • Collections
  • Kumite
  • Social
  • Discourse
  • Conversations (23)
  • Replies
  • Authored
  • Needs Resolution
  • Custom User Avatar
    • ob1lan
    • commented on "Beginner Series #2 Clock" python solution
    • 7 months ago

    There is no input validation, while the exercise mentioned some constraints

  • Custom User Avatar
    • CClairvoyant
    • commented on "Beginner Series #2 Clock" python solution
    • 13 months ago

    Yeah. It passed all the tests, therefore it's incorrect. Solid logic.

  • Custom User Avatar
    • CrawfordAndWood
    • commented on "Beginner Series #2 Clock" python solution
    • 14 months ago

    This is incorrect.

  • Custom User Avatar
    • Chenny0892
    • commented on "Beginner Series #2 Clock" python solution
    • 17 months ago

    but its not supposed to go above 24 hours right?

  • Custom User Avatar
    • Chenny0892
    • commented on "Beginner Series #2 Clock" python solution
    • 17 months ago

    that looks more efficient compared to how i did it XD

  • Custom User Avatar
    • 1989andres
    • commented on "Beginner Series #2 Clock" python solution
    • 2 years ago

    You are not wrong, but maybe data can be validated with another function, for example one that checks in first place if h, m and s are numbers (float or integers), then another function to check if they are content in a specific range.

    But as long as you are not being told to specifically do the data validation, just doing the maths is fine for this function. The input constraints can be understand as a condition already satisfied.

  • Custom User Avatar
    • 1989andres
    • commented on "Beginner Series #2 Clock" python solution
    • 2 years ago

    https://peps.python.org/pep-0008/

  • Custom User Avatar
    • 1989andres
    • commented on "Beginner Series #2 Clock" python solution
    • 2 years ago

    I don't understand your point.

  • Custom User Avatar
    • 1989andres
    • commented on "Beginner Series #2 Clock" python solution
    • 2 years ago

    I'm not sure. I think it depends of the context of the function and that is something to not worry about at this stage.

    If I get picky, there is no documentation or function contract. When I read the given definition of the function, it must do only the maths behind the conversion. It doesn't say that it should validate data, what if I use as input (O, !, 1)?

    The sepecifications of the input constraints makes me interpret them as the function's preconditions. Maybe a special function that validates what a day, hour and minute should look like is in charge of that and that would be a better practice too, isn't it?.

  • Custom User Avatar
    • jephcollins
    • commented on "Beginner Series #2 Clock" python solution
    • 2 years ago

    I agree with others who are of the opinion that this particular solution cannot be labeled "best practice". The instructions include a limit of <=23 which is not applied in this solution.

  • Custom User Avatar
    • tmills9208
    • commented on "Beginner Series #2 Clock" python solution
    • 2 years ago

    In my own projects, I will do this. Codewars though, I just like making an effort to try putting everything in 1 line of code. especially with python, theres been many instances of this lol.

  • Custom User Avatar
    • OFin
    • commented on "Beginner Series #2 Clock" python solution
    • 2 years ago

    It will not work for sum of hours, munites and seconds more then 24hours.

  • Custom User Avatar
    • jeremyfox36
    • commented on "Beginner Series #2 Clock" python solution
    • 2 years ago

    It isn't best practice to use magic numbers. I know it's fairly obvious what the numbers mean, but it's a bad habit to get into.

  • Custom User Avatar
    • OrlandoLeyva
    • commented on "Beginner Series #2 Clock" python solution
    • 3 years ago

    Maybe you could first validate that the inputs are within a valid range.

  • Custom User Avatar
    • SamuelNarciso
    • commented on "Beginner Series #2 Clock" python solution
    • 3 years ago

    Nice job! :D

  • Loading more items...
  • © 2025 Codewars
  • About
  • API
  • Blog
  • Privacy
  • Terms
  • Code of Conduct
  • Contact

Confirm

  • Cancel
  • Confirm

Collect: undefined

Loading collection data...