Week 6 - Python

Welcome to CS50 again! This blog will contain my review for Week 6's content about Python.

Lecture

  1. Nothing much to note down.

Section

  1. Nothing to note down. Try yourself and read the document is quite helpful.

Shorts

  1. Not much to note down. Just introduction to Python.

Problem Set 6

C-to-Python-Sentimental

Nothing to say

DNA

Divide and Conquer

Useful Snippets

  1. Check for command-line uasge

  1. Read database file into a variable

  1. Read DNA sequence file into a variable

  1. Find longest match of each STR in DNA sequence

  1. Check database for matching profiles

Take-aways

  1. The command-line arguments are stored in sys.argv, which is a list. The first argument, which is sys.argv[0] is the script's name and the arguments after this are the actual arguments.

  2. Using this code to read from the file,

3. The == can be used to determine whether two dictionaries are equivalent or not. 4. To pop a specific key:value pair from the dictionary,

  1. To add add a key:value pair to the dictionary,

Lecture - Week6.5

  1. In reinforcement learning, if the agent does well, you give them a reward, otherwise, punish them.

Last updated