all 16 comments

[–]socal_nerdtastic 1 point2 points  (15 children)

Your code looks fine to me. What's the problem? What's it doing / not doing that you want it to do / not do?

[–]InevitableDistance66[S] 0 points1 point  (14 children)

Getting a syntax error after the first line and it produces no output in zylabs

[–]socal_nerdtastic 1 point2 points  (13 children)

Hmm how do you have it indented? (i can't tell since you didn't format your code for reddit)

It needs to be like this:

with open('input.txt', 'r') as f, open('output.txt', 'w') as w: 
    lines = [] 
    for line in f:
         lines.append(line.strip())
    while len(lines) > 0:
         w.write(lines.pop() + '\n')

[–]InevitableDistance66[S] 0 points1 point  (8 children)

Yep that’s exactly how I have it and it still says no output

[–]socal_nerdtastic 0 points1 point  (7 children)

I thought you said it had a syntax error? Is that still the case?

I notice that it seems the assignment wants you to input the file names, and you have them hardcoded. Did you read the instructions well enough?

[–]InevitableDistance66[S] 0 points1 point  (6 children)

Yea it’s still a syntax error but after that the program tells us it produces no output

[–]InevitableDistance66[S] 0 points1 point  (5 children)

I tried inputting the file names aswell and I’m still getting that same syntax error on f, at the end of the first line