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
class student: | |
def __init__(self, name, age, marks): | |
self.name1 = name | |
self.age1 = age | |
self.marks1 = marks | |
def read_file(FH): | |
file1 = FH.read() | |
file2 = file1.split() | |
return file2 |
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
class car: | |
def __init__(self,odometer,milage,capacity): | |
self.odometer1 = odometer | |
self.milage1 = milage | |
self.capacity1 = capacity | |
def milageNumber(): | |
mil = input("Enter the milage: ") | |
return mil |
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
from statistics import mean | |
def Average(lst): | |
return mean(lst) | |
dict = {} | |
tempkey = [] | |
tempvalue = [] | |
dictList = [] |
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
shelltext = dict() | |
key1 = shelltext.keys() | |
print (key1) | |
key1.sorted() | |
print (key1) |
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 read_line(FH): | |
text_file = FH.read() | |
mytext_file = text_file.split() | |
return mytext_file | |
def search_word(): | |
name1 = input("Enter the name to search: ") | |
return name1 |
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 read_line(FH): | |
text_file = FH.read() | |
all_files = text_file.split() | |
return all_files | |
def main(): | |
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
age = {'sam':45,'ram':64,'kiran':65} | |
a1_sorted_keys = sorted(age, key=age.get, reverse=True) | |
for r in a1_sorted_keys: | |
print (r, age[r]) |
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
from collections import OrderedDict | |
contacts = {'sam':1222,'ram':53232,'samy':64343} | |
OrderedDict(sorted(contacts.items(), key=lambda t: t[0])) | |
print (contacts) |
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
import random | |
def numbers(): | |
list=[] | |
for i in range(1,11): | |
rand_number = input("Enter the number: ") | |
list.append(rand_number) | |
return list | |
def main(): |
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 namemark(): | |
name, mark = input("Enter name and mark: ").split() # taking two inputs at a time | |
if (mark > 90): | |
return name,mark | |
def main(): | |
myfile = open("numberfile.txt","a") | |
number_entered = namemark() |
NewerOlder