Please ignore secret bonuses. Secret tests do NOT award bonus. Max hw grade is 30+2 bonus efficiency

Do you need help?

Commas In matrices

Luigi Pizza (6120 points)
14 20 65
in HW6 by (6.1k points)
edited by

Every line inside each of the text files of the folder matrices never never ends with a number but always with one and just one comma.

For anybody interested there is a part of the comment in program01.eng.py that states:

''''The file contains on each line groups
of 5 integer values, followed by 1 comma and/or 0 (or more) spaces or
tabs.'''
 

So there will always be a final comma.

329 views

2 Answers

e
enricomaria.follega (1460 points)
9 18 29
by (1.5k points)

cool just use .split() method to hundle spaces and commas and .isnumeric() method to hundle integers. cool

There cannot be negative and float numbers thus all .isnumeric() exeptions will stay out of the program in any case.

Once you implemented these methods any letter or symbol the string is spaced with or ended with, shouldn't bother you at all.

Excale (490 points)
0 0 6
by (490 points)

It shouldn't be a problem.

What you expect on every line are n numbers which tell you info about the buildings. Every building requires 5 numbers (width, height and 3 for colour), so write your code on the assumption that n is gonna be a multiple of 5 (always true) and you're good to go.