Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,152,857 members, 7,817,541 topics. Date: Saturday, 04 May 2024 at 02:00 PM |
Nairaland Forum / Science/Technology / Programming / A Test For Python Guys. What Will This Code Do? (1359 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)
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) + ": ", 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: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: 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: 10:50am On Sep 29, 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: 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. |
(1) (Reply)
Design Worldclass Android,ios,apple And Kindle Apps Without Writing Any Code / I Need Contributors And Developers To Create An Altcoin / A Nigerian Has Developed An App That Detects Asphyxia In Babies From Their Cry
(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. 11 |