Skip to main content

CS50-Python certification

CS50’s Introduction to Programming with Python
#

Github repository
#

Here you can check the Github repository used trough the course.

Certificate
#

Here you can see my certificate of the course.

Week 0: Functions, Variables
#

This week covers fundamental programming concepts including functions, data types, and debugging techniques, providing a foundational understanding for writing and troubleshooting code.

Key concepts
ConceptDetails
FunctionsA block of code that performs a specific task.
Bugs and DebuggingMistakes in the code and how to fix them.
Data TypesThe type of data that a variable can store.
Named ParametersParameters that are passed by name.
String MethodsMethods that can be used with strings.
Integers and OperatorsOperators that can be used with integers.
Type ConversionConverting one data type to another.

Week 1: Conditionals
#

This week discusses control flow elements like conditionals and logical operators, which are essential for making decisions in code and controlling how it executes.

Key concepts
ConceptDetails
Comparison OperatorsOperators that compare two values.
ifA way to run code conditionally.
elifA way to run code conditionally if the first condition is false.
elseA way to run code if all other conditions are false.
orA way to combine conditions.
not equalA way to check if two values are not equal.
andA way to combine conditions.
chainsA way to combine multiple conditions.
moduloA way to get the remainder of a division.
booleanA way to represent true or false values.
pythonic expressionsA way to write code in a more concise way.
matchA way to match a value to a pattern.

Week 2: Loops
#

This week focuses on loops in programming, detailing how to iterate over data structures using for and while loops, and discussing concepts such as nested loops and list iteration.

Key concepts
ConceptDetails
LoopsThe ability of doing something multiple times.
whileA way to repeat a block of code while a condition is true.
forA way to repeat a block of code a number of times.
Validating inputA way to ensure that the input is correct.
Iteration with ListsA way to iterate over a list.
lenA way to get the length of a list.
DictionariesA way to store key-value pairs.
List of DictionariesA way to store a list of dictionaries.
Nested LoopsA way to have a loop inside another loop.

Week 3: Exceptions
#

This week focuses on error management in Python, detailing different types of exceptions and methods to handle them, ensuring robust and error-free code execution.

Key concepts
ConceptDetails
ExceptionsA way to handle errors in the code.
Syntax ErrorA mistake in the code that the Python interpreter cannot execute.
ValueErrorAn error that happens when you try to convert a string to a number, but the string is not a number.
try, exceptA way to handle exceptions.
NameErrorAn error that happens when you try to use a variable that is not defined.
elseA way to run code if the try block does not raise an exception.
Reprompting, breakA way to reprompt the user if the input is not valid.
get_intA way to create a function to get an integer from the user.
passA way to do nothing.
function argumentsA way to pass arguments to a function.
raiseA way to raise an exception.

Week 4: Libraries
#

This week introduces the concept of libraries and modules in Python, explaining how to import and use them, along with mentioning popular libraries for statistical analysis and file handling.

Key concepts
ConceptDetails
LibrariesA piece of code that someone else wrote that you can use in your code.
ModulesA library that has one or more functions built into it.
importTo use a module, you have to import it.
fromThe keyword to import a specific function from a module.
statisticsA built-in module in Python that has a set of functions to calculate statistics.
Command-line Arguments, sysThe sys module provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter.
Packages, PyPI, pipPackage: A collection of modules. PyPI: Python Package Index, a repository of software for Python. pip: a package installer for Python.
Custom LibrariesCreate your own library.

Week 5: Unit Tests
#

This week highlights the importance of testing in software development, discussing unit tests and the use of frameworks like pytest to ensure code quality and reliability.

Key concepts
ConceptDetails
Unit TestsA way to test the code you wrote.
assertA way to test the code you wrote.
AssertionErrorA way to handle an AssertionError.
pytestA testing framework that makes it easy to write small tests.
Side Effects and TestingA way to test the code you wrote.
Collection of TestsA way to group tests together.

Week 6: File I/O
#

This week covers file input/output operations, explaining how to read and write data, manage file formats like CSV, and manipulate data structures such as lists and dictionaries.

Key concepts
ConceptDetails
File I/OA way to read and write data to and from files.
listsData is stored in a list, but the moment the program is closed, the data is lost.
openUsed to open a file.
withUsed to open a file and automatically close it when the block is done.
Reading from a fileUse the read method to read the entire file, or readline to read one line at a time.
sortedUsed to sort a list.
Comma-Separated Values (CSV)A file format used to store tabular data.
sort keysUsed to sort a list of dictionaries by a key.
Lambda FunctionsA way to create small anonymous functions.
CSV LibraryA library that can be used to read and write CSV files.
Images, PIL LibraryA library that can be used to read and write images.

Week 7: Regular Expressions
#

This week explores regular expressions as powerful tools for string matching and validation, detailing how to use them effectively within Python programs.

Key concepts
ConceptDetails
Regular ExpressionsA pattern that we can use to match strings.
Validation with Regular ExpressionsA way to validate strings using regular expressions.
re LibraryA library that allows us to define a pattern to match strings.
Regular Expressions PatternsA set of symbols that can be used to match strings.

Week 8: Object-Oriented Programming
#

This week outlines the principles of OOP, including classes, objects, and inheritance, emphasizing how these concepts facilitate code organization and reuse.

Key concepts
ConceptDetails
Object-Oriented Programming (OOP)A programming paradigm that uses “objects” to design applications and computer programs.
TuplesA collection of objects that are ordered and immutable.
DictionariesA collection of key-value pairs that is more powerful than a list.
Classes and ObjectsA class is a blueprint or a mold for creating objects.
Instance MethodsFunctions defined inside a class used to perform operations on objects of that class.
Types and ClassesA type is a category of values, and a class is a blueprint for creating objects.
Class methodsMethods that are bound to the class and not the object of the class.
Static methodsMethods that are bound to the class and not the object of the class.
InheritanceA way to create a new class that is based on an existing class.
Operator OverloadingA way to define how an operator behaves when used with a class.

Week 9: Et Cetera
#

This week presents advanced programming features like sets, global variables, type hints, and comprehensions, enhancing Python’s functionality and readability while promoting best practices.

Key concepts
ConceptDetails
setA collection of unique elements; an unordered collection of items.
globalUsed to declare that a variable inside the function is global (outside the function).
constantsA type of variable whose value cannot be changed.
Type Hints, mypyA static type checker for Python.
DocstringsA string that appears right after the definition of a function, class, or module.
argparseA module in the Python standard library that allows you to parse command-line arguments.
unpackingA way to assign the elements of an iterable to multiple variables.
mapA function that applies a given function to each item of an iterable (list, tuple, etc.).
List ComprehensionsA way to create lists in Python.
filterA function that filters elements of an iterable based on a given function.
Dictionary ComprehensionsA way to create dictionaries in Python.
enumerateA function that adds a counter to an iterable.
Generators, IteratorsA way to create iterators in Python.

Weeks in detail
#

Week 9: Et Cetera
·1740 words·9 mins
A set is a collection of unique elements. It is an unordered collection of items. Sets are used to store multiple items in a single variable. It is a collection data type in Python.
Week 8: Object-Oriented Programming
·2154 words·11 mins
This week outlines the principles of OOP, including classes, objects, and inheritance, emphasizing how these concepts facilitate code organization and reuse.
Week 7: Regular Expressions
·748 words·4 mins
This week explores regular expressions as powerful tools for string matching and validation, detailing how to use them effectively within Python programs.
Week 6: File I/O
·1029 words·5 mins
This week covers file input/output operations, explaining how to read and write data, manage file formats like CSV, and manipulate data structures such as lists and dictionaries.
Week 5: Unit Tests
·590 words·3 mins
This week highlights the importance of testing in software development, discussing unit tests and the use of frameworks like pytest to ensure code quality and reliability.
Week 4: Libraries
·426 words·2 mins
This week introduces the concept of libraries and modules in Python, explaining how to import and use them, along with mentioning popular libraries for statistical analysis and file handling.
Week 3: Exceptions
·415 words·2 mins
This week focuses on error management in Python, detailing different types of exceptions and methods to handle them, ensuring robust and error-free code execution.
Week 2: Loops
·506 words·3 mins
This week focuses on loops in programming, detailing how to iterate over data structures using for and while loops, and discussing concepts such as nested loops and list iteration.
Week 1: Conditionals
·664 words·4 mins
This week discusses control flow elements like conditionals and logical operators, which are essential for making decisions in code and controlling how it executes.
Week 0: Functions, Variables
·746 words·4 mins
This week covers fundamental programming concepts including functions, data types, and debugging techniques, providing a foundational understanding for writing and troubleshooting code.