Premium Only Content
This video is only available to Rumble Premium subscribers. Subscribe to
enjoy exclusive content and ad-free viewing.

Opening and Reading a File |Section 5| Celestial Warrior
2 years ago
1
Please download the text file from the attachment.
Then write some code that reads the content of the file andgenerates the following output in the command line:
pear
apple
orange
mandarin
watermelon
pomegranate
file = open("fruits.txt", "r")
content = file.read()
file.close()
print(content)
Please modify thecode of the previous exerciseso that instead of printing out thelines in the terminal, it prints out the length of each line.
Expected output:
4
5
6
8
10
11
file = open("fruits.txt", "r")
content = file.readlines()
file.close()
for i in content:
print(len(i.strip()))
Loading comments...
-
17:53
foyo Games
2 years agoShadow Era | Shadow Warrior Opening
4 -
21:44
Jasmin Laine
3 hours agoTrump Haters SILENCED—Historic Peace Deal PROVES Them ALL Wrong
5265 -
LIVE
SmashJT
2 hours agoEMERGENCY DETAILS | Smashcast
34 watching -
LIVE
LFA TV
22 hours agoLIVE & BREAKING NEWS! | MONDAY 10/13/25
733 watching -
1:26:42
Katie Miller Pod
3 hours ago $2.42 earnedEpisode 10 - Kellyanne Conway | The Katie Miller Podcast
12.5K1 -
1:02:23
BonginoReport
3 hours agoTrump Brokers Peace In The Middle East - Nightly Scroll w/ Hayley Caronia (Ep.154)
66.8K18 -
1:02:11
The Nick DiPaolo Show Channel
4 hours agoTrump Pulls Off Unthinkable | The Nick Di Paolo Show #1803
13.9K8 -
LIVE
Rallied
2 hours agoBF6 with THE BOYS
81 watching -
LIVE
The Mike Schwartz Show
3 hours agoTHE MIKE SCHWARTZ SHOW Evening Edition 10-13-2025
2,662 watching -
58:57
TheCrucible
3 hours agoThe Extravaganza! EP: 52 with guest host Rob Noerr (10/13/25)
63.8K12