Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.Write a python script that takes an input file and creates a 2 dimensional array Then performs the following FUNCTIONS. ALL HAVE TO BE FUNCTION

1.Write a python script that takes an input file and creates a 2 dimensional array

Then performs the following FUNCTIONS. ALL HAVE TO BE FUNCTION AND INTERACT and work based on an interface.

2.Hailstone Sequence

3.Area of a Circle

4.Print range of each character pair

5.Print range of each numeric pair

6. Eratosthanes Sieve

Here is input file

def SieveOfEratosthenes(n):

# Create a boolean array "prime[0..n]" and initialize
# all entries it as true. A value in prime[i] will
# finally be false if i is Not a prime, else true.
prime = [True for i in range(n + 1)]
p = 2
while (p * p <= n):

# If prime[p] is not changed, then it is a prime
if (prime[p] == True):

# Update all multiples of p
for i in range(p ** 2, n + 1, p):
prime[i] = False
p += 1
prime[0]= False
prime[1]= False
# Print all prime numbers
for p in range(n + 1):
if prime[p]:
print (p) #Use print(p) for python 3

Step by Step Solution

3.29 Rating (152 Votes )

There are 3 Steps involved in it

Step: 1

1 nrows intinputNumber of rows ncolumns intinputNumber of columns Define the matrix matrix printEnte... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Auditing and Assurance services an integrated approach

Authors: Alvin a. arens, Randal j. elder, Mark s. Beasley

14th Edition

133081605, 132575957, 9780133081602, 978-0132575959

More Books

Students also viewed these Programming questions