social.sndevs.com is one of the many independent Mastodon servers you can use to participate in the fediverse.
The largest independent ServiceNow developer community with over 11,000 registered members and 500 active daily users. SNDevs.com

Administered by:

Server stats:

8
active users

#python3

0 posts0 participants0 posts today
Karsten Johansson<p>WARNING: Awesome code follows</p><p>I just read there is a more accurate way to calculate a dog's age in human years than simply multiplying by 7 (which does produce a lot of oddities, especially when it comes to dogs giving birth at "7" years old lol). The progression through the first, second and then subsequent years are handled in a manner that is much closer to how dogs typically age compared to humans.</p><p>Here are <a href="https://infosec.exchange/tags/lisp" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>lisp</span></a> and <a href="https://infosec.exchange/tags/python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>python</span></a> functions demonstrating the new calculations. Feel free to use them as you wish. Especially if you have one or more dogs.</p><p>Feel free to improve or comment on the code in the comments or elsewhere. I always post these kinds of functions for conversation and community, I'm just learning python, so don't bark too loudly.</p><p>The formats are:</p><p>(dogs-age years months)<br>and<br>dogs_age(years, months)</p><p>There is no error checking, so use zeros when necessary.</p><p>Don't be strangers. Shake a paw!</p><p><a href="https://infosec.exchange/tags/commonlisp" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>commonlisp</span></a> </p><p>(defun dogs-age (years months)<br> "Calculate the human age equivalent of a dog given its age in years and months."<br> (let ((human-age 0))<br> (cond<br> ((&lt; years 1)<br> (setq human-age (* (/ months 12.0) 15)))<br> ((= years 1)<br> (setq human-age (+ 15 (* (/ months 12.0) 9))))<br> ((&gt;= years 2)<br> (setq human-age (+ 15 9<br> (* (- years 2) 5)<br> (* (/ months 12.0) 5)))))<br> human-age))</p><p><a href="https://infosec.exchange/tags/python3" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>python3</span></a> </p><p>def dogs_age(years, months):<br> """<br> Calculate the human age equivalent of a dog given its age in years and months.<br> """<br> if years &lt; 1:<br> human_age = months * (15 / 12)<br> elif years == 1:<br> human_age = 15 + months * (9 / 12)<br> else:<br> human_age = 15 + 9 + (years - 2) * 5 + months * (5 / 12)</p><p>return human_age</p> <p>Hey, <span class="h-card" translate="no"><a href="https://social.sdf.org/@praetor" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>praetor</span></a></span> you might be interestd in this, even if it isn't about cats. If you change the subsequent years from 5 to 4, it'll work for cats just the same, apparently. :ablobdj: </p><p><a href="https://infosec.exchange/tags/dog" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>dog</span></a> <a href="https://infosec.exchange/tags/dogs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>dogs</span></a> <a href="https://infosec.exchange/tags/dogsofmastodon" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>dogsofmastodon</span></a> <a href="https://infosec.exchange/tags/mondog" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>mondog</span></a></p>
Aaron Longchamps<p>That's probably enough coding for tonight. I got all the REST endpoints I think I need for now and have extremely basic tests written for them. The tests check the return code is 200 and the integer returned is the right number.</p><p>On the actual implementation of the functions, I'm returning some number that the test is looking for so I know I'm getting to the right function.</p><p>I am kinda curious if there's a test coverage tool that will tell me how much of my code is running when I run the tests. There's probably something in pytest for that which I can research another time. Rather than trying to hit 100%, I would use it to find out if I'm missing anything as I keep adding code.</p><p><a href="https://infosec.exchange/tags/python3" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>python3</span></a> <a href="https://infosec.exchange/tags/fastapi" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>fastapi</span></a> <a href="https://infosec.exchange/tags/swagger" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>swagger</span></a></p>
Ahmed_bytes<p>Day 1-2 of <a href="https://social.sndevs.com/tags/100DaysOfCode" class="mention hashtag" rel="tag">#<span>100DaysOfCode</span></a> <br />Solved more Hackerrank challenges<br />Completed <a href="https://social.sndevs.com/tags/ALX_SE" class="mention hashtag" rel="tag">#<span>ALX_SE</span></a> Python Data Structures and Import modules projects<br />Learnt about Modules and how to import them<br />Started and Finished 7tasks of <a href="https://social.sndevs.com/tags/adventofcyber2023" class="mention hashtag" rel="tag">#<span>adventofcyber2023</span></a> </p><p><a href="https://social.sndevs.com/tags/survivors" class="mention hashtag" rel="tag">#<span>survivors</span></a> <a href="https://social.sndevs.com/tags/techy" class="mention hashtag" rel="tag">#<span>techy</span></a> <a href="https://social.sndevs.com/tags/python3" class="mention hashtag" rel="tag">#<span>python3</span></a> <a href="https://social.sndevs.com/tags/adventofcyber2023" class="mention hashtag" rel="tag">#<span>adventofcyber2023</span></a></p>
Aitor Cereceto :godot:<p><a href="https://mastodon.gamedev.place/tags/introduction" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>introduction</span></a></p><p>Hello. Name's Aitor, from Spain, 30yo. I'm currently working at Glovo as Software Engineer in Live Operations Platforms team where I developed ETL extractions from several customer solutions platforms and made apps using <a href="https://mastodon.gamedev.place/tags/GodotEngine" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>GodotEngine</span></a> and <a href="https://mastodon.gamedev.place/tags/python3" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>python3</span></a>. I'm <a href="https://mastodon.gamedev.place/tags/FLOSS" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>FLOSS</span></a> lover, and a <a href="https://mastodon.gamedev.place/tags/gamedev" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>gamedev</span></a> enthusiastic. Never done a game in my life but I follow nearly the gamedev world and I want to develop my firsts games.<br>I hope you know about me soon!</p>
Larry Clough<p>Hi! This is my <a href="https://masto.ai/tags/TwitterMigration" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>TwitterMigration</span></a> <a href="https://masto.ai/tags/Introduction" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Introduction</span></a> . </p><p>I am a retired Software Engineer and Software Engineering Manager, recently resettled in the US Pacific Northwest. <a href="https://masto.ai/tags/Linux" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Linux</span></a> <a href="https://masto.ai/tags/Python3" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Python3</span></a></p><p>I am interested in Science Fiction and Fantasy. Before the pandemic, I attended several SFF conventions a year.</p>