topScore = 0
for i in x :
if i > topScore :
topScore = i
print (topScore )
Fields, records and structures
Surname , ID , Course , College = "Grant" , "5129" , "Comp Sci" , "Warwick"
class recordStructure ():
def __init__ (self , field1 , field2 , field3 ):
self .surname = Surname
self .id = ID
self .course = Course
self .college = College
fileName = "./text.txt"
with open (fileName , "r" ) as f :
for line in f .readlines ():
print (line )
fileName = "./text.txt"
with open (fileName , "w" ) as f :
for i in range (1 ,5 ):
inputString = input ()
f .write (inputString )
with open ("myfile" , "rb" ) as f :
try :
byte = file .read (1 )
while byte != "" :
# Code for processing byte
byte = file .read (1 )
except :
pass
with open ("binaryFile.bin" , "wb" ) as f :
for value in binary :
f .write ('value' , b )
dictionary = {}
dictionary ["Computer" ] = 1
dictionary ["I" ] = 2
dictionary ["Love" ] = 3
dictionary ["Science" ] = 4
print (dictionary .get ("science" , "valuenot found" ))
if "science" in dictionary :
print (dictionary ["science" ])
else :
print ("value not found" )