About 7,790,000 results
Open links in new tab
  1. math - finding multiples of a number in Python - Stack Overflow

    Jan 28, 2013 · If you're trying to find the first count multiples of m, something like this would work: def multiples(m, count): for i in range(count): print(i*m) Alternatively, you could do this with …

  2. Print first m multiples of n without using any loop in Python

    Dec 19, 2024 · While loops are the traditional way to print first m multiples of n, Python provides other efficient methods to perform this task without explicitly using loops. This article will …

  3. Python program to print multiples of a given number

    Apr 29, 2023 · In this programming article, we are going to learn. The program to find the multiple sof a number in python is as follows: print ("The multiples are: ") for i in range (1,11): print …

  4. 5 different ways to print multiple values in Python

    Sep 15, 2021 · In this post, I will show you four different ways to print multiple values in Python with examples. Method 1: Pass multiple parameters to print: We can pass more than one …

  5. Print Elements which are Multiples of Elements Given in a List

    Feb 10, 2025 · Our task is to print those elements from "a" that are divisible by every element in "b". For example, if a is [4, 24, 8, 10, 12, 23] and b is [6, 4] then the output should be [24, 12] …

  6. How to make a script that prints the multiples of a number using …

    Jun 10, 2020 · This code with print all the multiples a given number x, n times. x = 2 n = 5 multiples = [x * i for i in range(1, n+1)] print(multiples) output: [2, 4, 6, 8, 10]

  7. Program to print the multiple occurrence of numbers in a list

    Oct 16, 2019 · I wrote this program to print how many times each number occurs in a list: def __init__(self): a=[] num=int(input("Enter the number of elements")) for i in range(0,num): try: …

  8. Python For Loops - W3Schools

    With the for loop we can execute a set of statements, once for each item in a list, tuple, set etc. Print each fruit in a fruit list: The for loop does not require an indexing variable to set …

  9. Multiples of Natural Numbers in Python - LinkedIn

    Nov 4, 2023 · We know that all multiples of a natural number will follow a sequence: multiples of 3: 3, 6, 9, 12, 15, 18, 21, 24, 27, 30 ... multiples of 5: 5, 10, 15, 20, 25, 30, ... But with if we join …

  10. Execute statement every N iterations in Python - Stack Overflow

    Apr 11, 2011 · I have a very long loop, and I would like to check the status every N iterations, in my specific case I have a loop of 10 million elements and I want to print a short report every …

  11. Some results have been removed
Refresh