Indivisible numbers in python assignment expert

Indivisible Numbers

This Program name is Indivisible Numbers. Write a Python program to Indivisible Numbers

The below link contains Indivisible Numbers question, explanation and test cases

//drive.google.com/file/d/1f7eIquKcLG9PWczki8tG3PWLRrqX3HR1/view?usp=sharing

We need exact output when the code was run



def isDivisible[K]:
    counter=0
    for n in range[2,11]:
        if K%n==0:
            counter+=1
    return [counter>0]


N=int[input[]]
indivisibleNumber=0
for K in range[1,N+1]:
    if not isDivisible[K]:
        indivisibleNumber +=1
print[indivisibleNumber]

Learn more about our help with Assignments: Python

Answer to Question #220523 in Python for raj

Indivisible Numbers

You are given a positive integer

The first line of input is an integer

The output should be an integer representing the number of positive integers satisfying the above condition.

In the given example,

11 is not divisible by any number from 2 to 10. It is divisible by only 1, 11.So, the output should be

2.

N=int[input["Enter a positive integer: "]]


find=0
for ​K in range [1,N+1]:
    if [N%K==0]:
        find +=1
print[find]

Learn more about our help with Assignments: Python

 Harry  August 22, 2022

We will use a list to save numbers and will find the average of given numbers in the list. We know that to find the average of numbers, we simply divide the sum of all numbers by the count of all numbers. For example, to find the average of 2, 3, 4, and 5, we will simply add them[2+3+4+5 = 14] and simply divide them with 4[14÷4 = 3.5]. Now let’s convert the whole process to find the average of the given numbers with Python Code.

1. Python Code to find the average of given numbers using built-in methods

numbers = [1, 2, 3, 4]
total = sum[numbers]
average = total/len[numbers]
print[average]

Output:

2.5

2. Python Code to find the average of given numbers using for loop

numbers = [1, 2, 3, 4]
total = 0
count=0
for i in numbers:
    total = total + i
    count = count + 1
average = total/count
print[average]

Output:

2.5

Also Read:

  • Calculate Mean, Median, and Mode Python | Assignment with solution
  • Assignment|How to check prime number in python?
  • Assignment Helper|How to find the factorial of a number in python?
  • Assignment Helper|Python Program to Check if a Number is Positive, Negative, or 0
  • Assignment Helper | Python Program to Find the Square Root
  • Assignment Helper | Python Program to Display the multiplication Table
  • Assignment Helper | Python Program to Find the Largest Among Three Numbers
  • Assignment Helper | Leap Year Program in Python
  • Assignment Helper | Add Two Numbers Python
  • Assignment Helper | Python Program to Calculate the Area of a Triangle
  • Assignment Helper | Python Program to Solve Quadratic Equation
  • Assignment Helper | Python Program to Swap Two Variables
  • Assignment Helper | Python Program to Generate a Random Number
  • Assignment Helper | Python Program to Convert Kilometers to Miles
  • Assignment Helper | Python Program to Convert Celsius To Fahrenheit
  • Assignment Helper | Python Program to Check if a Number is Odd or Even
  • Assignment Helper | Python Program to Print all Prime Numbers in an Interval
  • Assignment Helper | Python Program to Print the Fibonacci sequence
  • Assignment Helper | Python Program to Check Armstrong Number
  • Assignment Helper | Python Program to Convert Kilometers to Miles
  • Assignment Helper | Python Program to Find Armstrong Number in an Interval
  • Assignment Helper | Python Program to Find the Sum of Natural Numbers
  • Assignment Helper | Python Program to Display Powers of 2 Using Anonymous Function
  • Assignment Helper | Python Program to Find Numbers Divisible by Another Number
  • Assignment Helper | Python Program to Convert Decimal to Binary, Octal, and Hexadecimal
  • Assignment Helper | Python Program to Find ASCII Value of Character
  • Assignment Helper | Python Program to Find HCF or GCD
  • Factorial Programming in Python
  • GCD Recursion in Python
  • What are Generators, Generator Functions, Generator Objects, and Yield?

Author: Harry

Hello friends, thanks for visiting my website. I am a Python programmer. I, with some other members, write blogs on this website based on Python and Programming. We are still in the growing phase that's why the website design is not so good and there are many other things that need to be corrected in this website but I hope all these things will happen someday. But, till then we will not stop ourselves from uploading more amazing articles. If you want to join us or have any queries, you can mail me at Thank you

Chủ Đề