Video 1: cwd = os.getcwd() data_path = os.path.join(cwd, 'bike-sharing-data', 'data.csv') line_counter = 0 with open(data_path) as data_file: for line in data_file: print(line) line_counter += 1 if( line_counter > 9 ): break ------- video 2: Tex processing line_counter = 0 with open(data_path) as data_file: for line in data_file: if line_counter == 0: pass else: line_stripped = line.strip() fields = line_stripped.split(',') dteday = fields[1] line_date = datetime.strptime(dteday, '%Y-%m-%d') line_counter += 1 -------- Video 3: text line_counter = 0 month_line_count = {} with open(data_path) as data_file: for line in data_file: if line_counter == 0: pass else: line_stripped = line.strip() fields = line_stripped.split(',') dteday = fields[1] line_date = datetime.strptime(dteday, '%Y-%m-%d') line_month = line_date.month if( line_month not in month_line_count ) : month_line_count[line_month] = 1 else: month_line_count[line_month] += 1 line_counter += 1 -------- Video 4: text usage_count = fields[-1] // use -1 to get last index -------- Video 5: text count_threshold = 6000 out_path = os.path.join(cwd, 'bike-sharing-data', f'days_over_{count_threshold}.csv') line_counter = 0 with open(data_path) as data_file open(out_path, 'w') as out_file: for line in data_file: if( line_counter == 0 ): pass else: line_stripped = line.strip() fields = line_stripped.split(',') usage_count = int(fields[-1]) if( usage_count > count_threshold ): out_file.write(line) line_counter += 1 -------- Video 6: text cwd = os.getcwd() baby_name_path = os.path.join(cwd, 'baby-names', 'Most_Popular_Baby_Names__1980-2013.csv') name_counts = {} with open (baby_name_path) as name_file: name_file.readline() //will skip the first line for line in name_file: ....... -------- Video 7: text myFile = open ('name of the file', 'r') for line in myFile: print(line) myFile.close() 1980AL09.... lineStrip = line.strip() year = lineStrip[0:4] ------ vIDEO 8: write file lineList = ['here', 'I', 'am', 'to', 'save', 'the', 'day'] with open('test.txt', 'w') as myFile: for line in lineList: line = ','.join(line) + '\n' myFile.write(line + '\n') fileToRead = "" fileToWrite = "" with open(fileToRead, 'r') as readFile, open(fileToWrite,'w') as writeFile: for line in readFile: rank,year,name,count = line.split(',') if name === 'William': lineToWrite = ','.join[rank, year] + '\n' writeFile.write(lineToWrite) file = open('filename.txt', 'r') try: contents = file.read() # Process the contents finally: file.close()