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? (1499 Views)
| 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) + " : ",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:Nairaland swallowed them ![]() |
| 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: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): 10:50am On Sep 29, 2016*. Modified: 7:50pm On Oct 01, 2016 |
adejumoadeoluwa:add |
| Re: A Test For Python Guys. What Will This Code Do? by Nascimento(m): 1:24am On Sep 30, 2016 |
Toniwirelex: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: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. ![]() |
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
People Stealing Programming Jobs on NL • I Need A Web Designer In Portharcourt • Thread closed
: ",
