Week 2: Stressed already?

Stress.

Week 2.

Stop.

I cannot determine whether it has been a good week or just another enduring struggle through the miasma that encapsulates ‘Uni life’. With the stress levels, far exceeding expectations and the stability of co-curricular becoming increasingly more demanding, my equilibrium between social life and academic life is deteriorating. Assignment, after assignment is being thrown at me, all without warning or a consideration for time.

Code1161, week 2, for the most part was enjoyable, exercise 1 and exercise 2 were simplistic and easy to work out. Almost like a walk in the park, however when I reached exercise 3 everything suddenly elevated and became difficult. Like being plunged straight into the deep end is the only way to describe this exercise, several issues continue to arise and most, not all, are refined and dealt with. I can only hope that I will soon wrap my head around some of these perplexing errors.

Exercise 0 ws simple such as adding a number greater than 5:

def add_5(a_number):

return a_number + 5

Or some simple code that could come in handy in the future such as how to return a string in uppercase, its as simple as:

return a_string.upper()

Exercise 1 was fun, simple and at times annoying. We were required to clean the errors, so no errors would appear in the Linter. Errors that appear frequently include simple fixes such as:

“Expected 2 blank lines, found 1.”

To fix this: Add another line above or underneath the line where the red dot appears.

Or errors like:

“Invalid Syntax”

To fix this: Generally this means that a colon has been used instead of a semicolon or vice versa. Scan the line of code and look at the syntax of the code, make sure the right symbols are used for the right functions.

Syntax → Is the structure of statements in a computer language.

Exercise 3 was challenging as this contained much harder examples. However our tutor gave us wise words; “Think logically”. With this in mind it came down to understanding the functions required. Such as in this example:

def loops_6():
 “””Make a wedge of numbers.

gist4 = [] →#Open empty list
… for x in range(10): →#Pass variable into a lists range
… rows = []
… for y in range(x + 1): →#Creating a matrix (Rows and columns) using a sequence
…… rows.append(str(y)) →#Everything is subbed in
… gist4.append(rows) →#Subbing the rows into ‘gist4’
 return gist4

A single golf clap? Or a long standing ovation?

By clapping more or less, you can signal to us which stories really stand out.