如何制作一个有助于根据年龄和身高找到匹配对的代码?

发布于 2025-02-12 11:00:07 字数 219 浏览 0 评论 0原文

我在寻找同一件事 https://stackoverflow.com/a/a/72842963/728334455 我的问题是制定条件,以便匹配的对应在古老的10岁之内,并且在10个高度差异之内,我需要代码才能找到达到这两个条件的匹配的随机匹配对。有人可以帮我吗?谢谢

I was looking for the same thing https://stackoverflow.com/a/72842963/18334455 but my problem is how to make a condition so that the matched pair should be within 10 years of age-old and within 10 height difference, I need my code to find the matched randomly matched pair that achieve both conditions. Can anybody help me with this? Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南风几经秋 2025-02-19 11:00:07

在IF条件下非常简单,这完全取决于您的数据类型,但从理论上讲,这可能是这样的:

if abs(age1 - age2) < 10 and abs(height1 - height2) < 10:
    print('Yay you are almost same height and age, so it must be a match!')

else: print('No match, you are way too different')

Pretty straight forward with an if condition, it all depends on your data types, but it could in theory look like this:

if abs(age1 - age2) < 10 and abs(height1 - height2) < 10:
    print('Yay you are almost same height and age, so it must be a match!')

else: print('No match, you are way too different')
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文