DEV Community

iamjaydev
iamjaydev

Posted on

4 2

[Basic] Python age calculator

๐Ÿ™‹โ€โ™‚๏ธ Hey there!
I hope you are doing well.

Here, I'm sharing the knowledge I gained from creating basic python projects for beginners.

After all

"The best way to learn things is getting hands dirty!"
๐Ÿ˜ƒ

Show me the code: python basic project with source code

1) What I Built

Python age calculator

  • Reusable Choices loop
  • Simple Age input with format validation (dd-mm-yyyy)
  • Age calculation logic to calculate age in various units
  • Print Age Calculation data

2) How I Built

  • Whole calculation logic is separate from UX
  • Code split is managed through a reusable manner
    • Common Logic is separate from app-specific logic
    • Logic is written in separate reusable function chunks

Conclusion
As per I believe, this blog post is helpful to those who are looking for python project ideas for beginners.

Jetbrains image

Donโ€™t Become a Data Breach Headline

57% of organizations have suffered from a security incident related to DevOps toolchain exposures. Is your CI/CD protected? Check out these nine practical tips to keep your CI/CD secureโ€”without adding friction.

Learn more

Top comments (3)

Collapse
 
geraldew profile image
geraldew โ€ข

It took me quite a lot of clicks to find the place where the calculations happen. From a quick look you don't seem to have a valid calculation method.

In short, the line:

  • years = seconds // (3600 * 24 * 365)

will not always be correct (for a couple of reasons).

Collapse
 
iamjaydev profile image
iamjaydev โ€ข

@geraldew Thanks for feedback ๐Ÿ‘

Collapse
 
harshad_tweet profile image
Harshad Prajapati โ€ข

I'm trying to implement something like this and I've found this one!

Thanks for sharing

Jetbrains image

Build Secure, Ship Fast

Discover best practices to secure CI/CD without slowing down your pipeline.

Read more

๐Ÿ‘‹ Kindness is contagious

Please leave a โค๏ธ or a friendly comment on this post if you found it helpful!

Okay