Saved Bookmarks
| 1. |
Suppose content of 'Myfile.txt' isTwinkle twinkle little star How I wonder what you are Up above the world so high Like a diamond in the sky Twinkle twinkle little star What will be the output of the following code?myfile = open("Myfile.txt") line_count = 0 data = myfile.readlines() for line in data: if line[0] == 'T': line_count += 1 print(line_count) myfile.close()a. 2 b. 3 c. 4 d. 5 |
|
Answer» Answer is a. 2 |
|