This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fname = input("Enter file name: ") | |
fh = open(fname) | |
count = 0 | |
for line in fh: | |
line=line.rstrip() | |
if line.startswith('From:'): | |
continue | |
if not line.startswith('From'): | |
continue | |
words=line.split() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fname = input("Enter file name: ") | |
fh = open(fname) | |
lst = list() | |
for line in fh: | |
line=line.rstrip() | |
words=line.split() | |
for word in words: | |
if not word in lst: | |
lst.append(word) | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
flname = input("Enter the file name: ") | |
fhandle = open(flname) | |
count = 0 | |
total = 0 | |
for i in fhandle: | |
if not i.startswith("X-DSPAM-Confidence:"): | |
continue | |
else: | |
t = i.find("0") | |
num = float(i[t+1:].rstrip()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
text = "X-DSPAM-Confidence: 0.8475" | |
startpos= text.find('0') | |
afterpos= text[startpos:] | |
endpos= float(afterpos) | |
print(endpos) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
largest = None | |
smallest = None | |
while True: | |
try: | |
num = input("Enter a number: ") | |
if num == "done": | |
break | |
n=int(num) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def computepay(h,r): #defining the computepay function | |
if h>40: | |
p=(1.5*(h-40)*r)+(40*r) | |
else: | |
p=40*r | |
return p | |
# taking input | |
hrs =input("Enter Hours:") | |
h=float(hrs) | |
rate =input("Enter rate per hour:") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
score = input("Enter Score: ") | |
try: | |
s=float(score) | |
except: | |
print("Error,value out of range") # if type is not float | |
quit() | |
if s>=1.0 or s<0.0: | |
print("Value out of range") #if the value is out of range | |
elif s>=0.9: | |
print('A') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hrs = input("Enter Hours:") | |
rate = input("Enter the rate per hour") | |
pay = int(hrs)*float(rate) | |
print("Pay:",pay) |