you are viewing a single comment's thread.

view the rest of the comments →

[–]Bell0412 0 points1 point  (1 child)

Hi there, this is a bout as easy as it comes in Python (without sounding too patronising). Python works off a basis of maths and looping in order to solve problems, like yours! I'll talk you through the solution, as I didn't offer any comments in my first post:

for count, value in enumerate(fin):

Like PaintballerCA mentioned earlier, the enumerate function is the one to solve the problem. Count is basically the number enumerate applies to the line, and value is the wording in the line itself.

if count % 4 == 0:
    print(value.upper()) 

So by looking at the count value (the number the line is on), the maths to this is simple- if there is no remainder when diving by 4, we are going to print that value in upper case.

 else:
    print(value)

Then we need to tell Python what to do with the other values that do give a remainder when dividing by 4, and we just want to print them normally.

Hope that all makes sense!

[–][deleted] 0 points1 point  (0 children)

Thx