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 -
LIVE
Drew Hernandez
8 hours agoEPSTEIN VICTIMS SPEAK OUT & TRUMP DOUBLES DOWN
900 watching -
1:36:41
FreshandFit
3 hours agoWe Are QUITTING YouTube...
23.1K27 -
2:34:22
TheSaltyCracker
3 hours agoDrug Smugglers Blown Up 9-03-25
56.3K129 -
LIVE
VapinGamers
2 hours ago $0.49 earnedGrim Trials - Game Review/Playthru - Rougelight Dungeon Crawler - !rumbot !music
73 watching -
2:47:55
Mally_Mouse
10 hours ago🎮 Let's Play!! -- Jak 2 pt. 16
20.4K1 -
52:23
MattMorseTV
4 hours ago $14.44 earned🔴The Cartels are SCREWED.🔴
89.6K112 -
1:32:46
Badlands Media
18 hours agoAltered State S3 Ep. 44
29.6K -
21:09
Bearing
15 hours agoAustralian “Racist” Protest EXPLODES 💥 Glowies, Brawls & Media Spin 📣
13.9K27 -
DVR
Tundra Tactical
3 hours ago $1.08 earnedTwo Vets, One Ouija Board, Zero Good Decisions
13.2K1