简体   繁体   English

如何检查数字是否可以被列表中的元素之一整除(Python)?

[英]How can I check if a number is divisible by one of the elements in a list (Python)?

So I am trying to do this problem where I have a number and I'm trying to create a list of multiples from both numbers of the list.所以我试图解决这个问题,我有一个数字,我试图从列表的两个数字创建一个倍数列表。

For Example:例如:

list1 = [9,10,12,16]

So I have these two lists.所以我有这两个列表。 Say I have a number 56. How do I check if 56 is divisible with all three numbers from list1 ?假设我有一个数字 56。我如何检查 56 是否可以被list1所有三个数字整除?

So I am trying to do this problem where I have a number and I'm trying to create a list of multiples from both numbers of the list.所以我试图解决这个问题,我有一个数字,我试图从列表的两个数字创建一个倍数列表。

For Example:例如:

list1 = [9,10,12,16]

So I have these two lists.所以我有这两个列表。 Say I have a number 56. How do I check if 56 is divisible with all three numbers from list1 ?假设我有一个数字 56。我如何检查 56 是否可以被list1所有三个数字整除?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何检查数字是否可以被另一个 Python 整除 - How to check if the number is divisible by another one Python 如何检查一个数字是否可以被列表中的每个数字整除? - How to check if a number is divisible by every number in a list? 检查 python 中的数字是否可被另一个整除 - Check if a number is divisible by another in python 如何编写一个将接受数字的程序,并通过不将数字除以5来检查其是否可以被5整除(在python中) - how to write a program that will take a number and check if it is divisible by 5 or not by not dividing the number by 5 (in python) PYTHON 我试图在发现第一个可被 16 整除的数字时打破循环,并打印结果以便我可以检查 - PYTHON I am trying to break loop when found first number divisible by 16, and print results so I can check 我想将一个可被 2 整除的数字与列表中的下一个可被 5 整除的数字交换 - I want to swap a number divisible by 2 with the next number divisible by 5 in a list 如何编程打印下一个可被 25 整除的 2675.9439 并在 python 中打印出来 - How can I program to print the next number of 2675.9439 which is divisible by 25 and print it out in python 在python中检查一个数字是否可以被另一个数字整除的最快方法 - Fastest way to check if a number is divisible by another in python 如何找到不能被 3 整除的最小 n 位数? - How can I find the smallest number of n digits that is not divisible by 3? 如何删除Python列表中所有出现的一个数字 - How can I remove all occurrences of one number in a list in Python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM