₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,067 members, 8,420,138 topics. Date: Thursday, 04 June 2026 at 12:02 PM

Toggle theme

A Test For Python Guys. What Will This Code Do? - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingA Test For Python Guys. What Will This Code Do? (1499 Views)

1 Reply (Go Down)

A Test For Python Guys. What Will This Code Do? by Toniwirelex(op): 4:49pm On Sep 28, 2016
import random
def get_int(msg, minimum, default):
while True:
try:
line = input(msg)
if not line and default is not None:
return default
i = int(line)
if i < minimum:
print("must be >=", minimum)
else:
return i
except ValueError as err:
print(err)
rows = get_int("rows: ", 1, None)
columns = get_int("columns: ", 1, None)
minimum = get_int("minimum (or Enter for 0): ", -1000000, 0)
default = 1000
if default < minimum:
default = 2 * minimum
maximum = get_int("maximum (or Enter for " + str(default) + "wink: ",
minimum, default)
row = 0
while row < rows:
line = ""
column = 0
while column < columns:
i = random.randint(minimum, maximum)
s = str(i)
while len(s) < 10:
s = " " + s
line += s
column += 1
print(line)
row += 1
Re: A Test For Python Guys. What Will This Code Do? by Toniwirelex(op): 4:52pm On Sep 28, 2016
haaaa, what happened to all my indentations .....
Re: A Test For Python Guys. What Will This Code Do? by MrKamar(m): 7:54pm On Sep 28, 2016
Toniwirelex:
haaaa, what happened to all my indentations .....
Nairaland swallowed them grin
Re: A Test For Python Guys. What Will This Code Do? by ANTONINEUTRON(m): 7:20am On Sep 29, 2016
It Seems Ur Function With Will Receive An Input, Check/validate The Input And Perform Some Calculations On It.

Just Maybe....Dunno Python
Re: A Test For Python Guys. What Will This Code Do? by Toniwirelex(op): 10:13am On Sep 29, 2016
ANTONINEUTRON:
It Seems Ur Function With Will Receive An Input, Check/validate The Input And Perform Some Calculations On It.

Just Maybe....Dunno Python
yea, the calculation is what am asking about.. well, idon't expect a proper interpretation of the above code becos of the absence of indentation.. thanks for tryin..
Re: A Test For Python Guys. What Will This Code Do? by adejumoadeoluwa(m): 10:34am On Sep 29, 2016
Hello guyz we happen to have a python group , if you are Open to joining then contact me on whatsapp , (see number in my signature)
Re: A Test For Python Guys. What Will This Code Do? by Toniwirelex(op):
adejumoadeoluwa:
Hello guyz we happen to have a python group , if you are Open to joining then contact me on whatsapp , (see number in my signature)
add
Re: A Test For Python Guys. What Will This Code Do? by Nascimento(m): 1:24am On Sep 30, 2016
Toniwirelex:
haaaa, what happened to all my indentations .....
The code aint readable
Re: A Test For Python Guys. What Will This Code Do? by Toniwirelex(op): 8:41am On Sep 30, 2016
Nascimento:
The code aint readable
true
Re: A Test For Python Guys. What Will This Code Do? by Oahray: 6:46pm On Sep 30, 2016
Hmmmm... I think it takes input for number of rows and columns, then prints a matrix of random numbers between a minimum and maximum range.

You gave me a headcahe trying to read this. undecided
1 Reply

Free Udemy Course For Python Programmers(2 days left)PYTHON CORNER; Request For Python AlgorithmsFree Python PDF Books To Download For Python Developer234

People Stealing Programming Jobs on NLI Need A Web Designer In PortharcourtThread closed