17.6k views
0 votes
Write a method called printRangeOfNumbers that accepts a minimum, maximum numbers as parameters and prints each number from minimum up to that maximum, inclusive, boxed by curly brackets. For example, consider the following method calls:

User Phylax
by
4.4k points

1 Answer

1 vote

Answer:

The method in python is as follows:

class myClass:

def printRange(min,max):

for i in range(min, max+1):

print("{"+str(i)+"} ", end = '')

Step-by-step explanation:

This line declares the class

class myClass:

This line defines the method

def printRange(min,max):

This line iterates from min to max

for i in range(min, max+1):

This line prints the output in its required format

print("{"+str(i)+"} ", end = '')

User Zitrax
by
4.1k points