Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,282 members, 7,807,948 topics. Date: Wednesday, 24 April 2024 at 11:41 PM

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

Nairaland Forum / Science/Technology / Programming / A Test For Python Guys. What Will This Code Do? (1354 Views)

Free Udemy Course For Python Programmers(2 days left) / PYTHON CORNER; Request For Python Algorithms / Free Python PDF Books To Download For Python Developer (2) (3) (4)

(1) (Reply) (Go Down)

A Test For Python Guys. What Will This Code Do? by Toniwirelex: 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: 4:52pm On Sep 28, 2016
haaaa, what happened to all my indentations .....

1 Like

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: 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: 10:50am On Sep 29, 2016
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: 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)

I Need Someone Who Can Teach Me How To Build Web Applications That Does This / Scared To Code But Want To Code / .

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 14
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.