repl.it
@RoselyAlvaradoV/

easter egg

Python

No description

fork
loading
Files
  • main.py
  • mbox.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
filename = input('enter the file name: ') #prompt for filename 
try:
 mailbox = open(filename) #opeans file name 
except:
  if filename == "na na boo boo": #if the file name happens to land on the easter egg
    print("The file you have tried to opean has jump off a cliff") #displays an unexpected message 
  else: 
    print("file canot be opeaned") #for a normal no exstent file 
  exit() #exits program 
count = 0  #starts counter
for line in mailbox: 
  if line.startswith("Subject: "): #searches for a line with subject 
    count+=1 #counts that line 
print("There were " + str(count) + " subject line in mbox.txt") #Displays the number