[英]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.