0

Chapter 6

My instructor told me I was missing something in this: I modified it. I saved the text file as exercise63.txt. Now this is what I have but I get syntax errors on the if line. def main(): lineNbr = 0 infile = open('Exercise63.txt', 'r') for lineNbr in range(5) : lineNbr = lineNbr + 1 line = infile.readline() line = line.rstrip('\n') If line = 0 print(lineNbr,':',line) infile.close() #----------------- main()

26th Apr 2020, 12:16 AM
alisha jones
alisha jones - avatar
2 Antworten
+ 2
You forgot to add ":" at the end of if statement. If line = 0:
26th Apr 2020, 3:33 AM
Tarun Kumar
Tarun Kumar - avatar
+ 1
Kindly share your code here.
26th Apr 2020, 3:32 AM
Tarun Kumar
Tarun Kumar - avatar