This file contains hidden or 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: ") | |
| try : | |
| fh = open(fname) | |
| except: | |
| print(fname," files does not exit .Enter valid file names") | |
| quit() | |
| for line in fh : | |
| line =line.rstrip()# for removing newline from the letter | |
| print(line.upper()) |
This file contains hidden or 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" | |
| start = text.find('0') | |
| end = text[start:29] | |
| end = float(end) | |
| print(end) |
This file contains hidden or 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: | |
| num = input("Enter a number: ") | |
| if num == 'done': | |
| break | |
| try : | |
| num = int(num) | |
| if (largest==None) : | |
| largest = num |
This file contains hidden or 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): | |
| if h>40 : | |
| return 40 * r + (h-40)*r*1.5 | |
| hrs = input("Enter Hours:") | |
| rate = input("Enter rate") | |
| try : | |
| hrs = float(hrs) | |
| rate = float(rate) | |
| except : |
This file contains hidden or 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: | |
| score = float(score) | |
| except : | |
| print("Please Enter Valid Input") | |
| quit() | |
| if score >= 0.9 : | |
| print("A") | |
| elif score>=0.8: | |
| print("B") |
This file contains hidden or 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 = int(input("Enter Hours:")) | |
| rate = input("Enter rate") | |
| rate = float(rate) | |
| if hrs>40 : | |
| print(rate*40 + (hrs-40)*1.5*rate) |
NewerOlder