fix(curriculum/ python): flesh out block pages (#55028)

This commit is contained in:
Zaira
2024-07-23 21:26:46 +05:00
committed by GitHub
parent 91b108f09e
commit 7c1884a37f
17 changed files with 126 additions and 28 deletions
@@ -6,4 +6,4 @@ superBlock: scientific-computing-with-python
## Introduction to the Build a Budget App Project
This is a test for the new project-based curriculum.
Build a Budget App Project
@@ -6,4 +6,4 @@ superBlock: scientific-computing-with-python
## Introduction to the Build a Polygon Area Calculator Project
This is a test for the new project-based curriculum.
Build a Polygon Area Calculator Project
@@ -6,4 +6,4 @@ superBlock: scientific-computing-with-python
## Introduction to the Build a Probability Calculator Project
This is a test for the new project-based curriculum.
Build a Probability Calculator Project
@@ -6,4 +6,4 @@ superBlock: scientific-computing-with-python
## Introduction to the Build a Time Calculator Project
This is a test for the new project-based curriculum.
Build a Time Calculator Project
@@ -6,4 +6,9 @@ certification: scientific-computing-with-python
## Introduction to Scientific Computing with Python
Learn the basics of Python.
The Scientific Computing with Python (Beta) curriculum will equip you with the fundamentals of scientific computing, including data structures and algorithms to solidify your understanding of Python programming.
Among the projects, you'll learn Python list comprehensions by building a case converter program, and master string manipulation by developing a cipher. The course also includes lessons on working with numbers and strings through implementing the Luhn algorithm and using lambda functions by creating an expense tracker.
The curriculum also covers algorithm design with the shortest path algorithm, recursion with the Tower of Hanoi puzzle, and data structures with the merge sort algorithm.
In addition to core programming skills, the curriculum emphasizes real-world applications of scientific computing. You'll learn about numerical methods, building a vector space and simulating projectile motion, making you proficient in scientific and analytical programming.
@@ -4,6 +4,12 @@ block: learn-algorithm-design-by-building-a-shortest-path-algorithm
superBlock: scientific-computing-with-python
---
## Introduction to Learn Algorithm Design by Building a Shortest Path Algorithm
## Learn Algorithm Design by Building a Shortest Path Algorithm
Learn Algorithm Design by Building a Shortest Path Algorithm
A shortest path algorithm finds the minimum distance between two nodes in a graph, ensuring the most efficient route. For finding the shortest path, lists and dictionaries are an excellent choice.
In the process of finding the shortest path, lists store sequences of nodes or edges. They facilitate easy indexing and iteration, making them ideal for managing collections of graph elements, such as unvisited nodes or adjacent nodes.
Dictionaries enhance the algorithm's efficiency with fast lookups. They can map nodes to their shortest path distances or store adjacency lists, allowing quick access and updates.
You'll also come across tuples that are useful for handling immutable data, representing edges or (node, distance) pairs that shouldn't change. Their immutability ensures data consistency throughout the algorithm's execution, contributing to a reliable implementation.
@@ -4,6 +4,10 @@ block: learn-classes-and-objects-by-building-a-sudoku-solver
superBlock: scientific-computing-with-python
---
## Introduction to Learn Classes and Object by Building a Sudoku Solver
## Learn Classes and Objects by Building a Sudoku Solver
Learn Classes and Object by Building a Sudoku Solver
Classes and objects are important programming concepts. These Object-Oriented Programming tools help developers to achieve code modularity, abstraction, and readability. They also promote reusability.
Sudoku Solver is a classical problem-solving game that requires logical thinking. It is a 9x9 grid puzzle where the objective is to fill each row, column, and 3x3 subgrid with numbers from 1 to 9 without repeating any number. The puzzle starts with some numbers already filled in, and the player must fill in the remaining cells to solve the puzzle.
In this Sudoku Solver project, you'll learn how to use classes and objects to build a Sudoku grid and to solve a Sudoku puzzle. The project leverages a `Board` class to represent the Sudoku grid and includes methods to check the validity of numbers, find empty cells, and solve the puzzle using a backtracking algorithm.
@@ -4,6 +4,10 @@ block: learn-data-structures-by-building-the-merge-sort-algorithm
superBlock: scientific-computing-with-python
---
## Introduction to Learn Data Structures by Building the Merge Sort Algorithm
## Learn Data Structures by Building the Merge Sort Algorithm
Learn Data Structures by Building the Merge Sort Algorithm
Data structures are fundamental concepts in computer science that allow you to organize and store data efficiently. Different data structures are used for various types of applications, each optimized for specific tasks.
The Merge Sort Algorithm is a sorting algorithm based on the divide and conquer principle, which involves breaking down a problem into smaller subproblems, solving each subproblem independently, and then combining the solutions to solve the original problem.
In this project, you'll learn how to interact with data structures by sorting a list of random numbers using the Merge Sort Algorithm. The Merge Sort Algorithm recursively divides the list into smaller sublists until each sublist contains a single element, then merges the sublists back together in the correct order.
@@ -4,6 +4,8 @@ block: learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algor
superBlock: scientific-computing-with-python
---
## Introduction to Learn How to Work with Numbers and Strings by Implementing the Luhn Algorithm
## Learn How to Work with Numbers and Strings by Implementing the Luhn Algorithm
Learn How to Work with Numbers and Strings by Implementing the Luhn Algorithm
Algorithms can be employed to see the validity of the given data. One such algorithm is the Luhn Algorithm, which is used to validate a variety of identification numbers, particularly credit card numbers. It is a simple formula that helps in detecting accidental errors in the sequences of numbers by verifying the final digit, known as the check digit, which is determined by a specific calculation on the other digits.
In this project, you will verify a given credit card number using the Luhn Algorithm. By building this project, you'll gain experience working with numerical computations and string manipulation. You will also perform operations like reversing strings and handling character replacements.
@@ -4,6 +4,32 @@ block: learn-lambda-functions-by-building-an-expense-tracker
superBlock: scientific-computing-with-python
---
## Introduction to Learn Lambda Functions by Building an Expense Tracker
## Learn Lambda Functions by Building an Expense Tracker
Learn Lambda Functions by Building an Expense Tracker
Lambda functions in Python, also known as anonymous functions, are small, unnamed functions defined using the `lambda` keyword. They provide a concise way to write simple, throwaway functions directly in your code, typically for use in a single, short-lived context.
If you were to write a function that filters out odd numbers, the function would look like this:
```python
def is_even(x):
return x % 2 == 0
numbers = [1, 2, 3, 4, 5, 6]
even_numbers = list(filter(is_even, numbers))
print(even_numbers)
# Output: [2, 4, 6]
```
However, if you were to write the same function using a lambda function, it would look like this:
```python
numbers = [1, 2, 3, 4, 5, 6]
even_numbers = list(filter(lambda x: x % 2 == 0, numbers))
print(even_numbers)
# Output: [2, 4, 6]
```
Concise right?
In this project, you'll explore the power of lambda functions by creating an expense tracker that allows you to add, list, total, and filter expenses by category. You'll see how the application leverages lambda functions to streamline certain operations, making the code more concise and easier to read.
@@ -4,6 +4,10 @@ block: learn-list-comprehension-by-building-a-case-converter-program
superBlock: scientific-computing-with-python
---
## Introduction to Learn List Comprehension by Building a Case Converter Program
## Learn List Comprehension by Building a Case Converter Program
Learn List Comprehension by Building a Case Converter Program
List comprehension is a way to construct a new Python list from an iterable, such as lists, tuples, and strings, without using a for loop or the `.append()` list method. It provides a concise and readable way to create lists and can be used to apply an expression to each item in the iterable.
In this project, you'll write a program that takes a string formatted in Camel Case or Pascal Case and converts it into Snake Case. Camel Case and Pascal Case are naming conventions where each word in the identifier is capitalized, with Camel Case starting with a lowercase letter (e.g., `camelCase`) and Pascal Case starting with an uppercase letter (e.g., `PascalCase`). Snake Case, on the other hand, separates words with underscores and uses only lowercase letters (e.g., `snake_case`).
The project has two phases: first, you'll use a for loop to implement the program. Then you'll learn how to use list comprehension instead of a loop to achieve the same results. This will help you understand the efficiency and elegance that list comprehension can bring to your code.
@@ -4,6 +4,15 @@ block: learn-recursion-by-solving-the-tower-of-hanoi-puzzle
superBlock: scientific-computing-with-python
---
## Introduction to Learn Recursion by Solving the Tower of Hanoi Puzzle
## Learn Recursion by Solving the Tower of Hanoi Puzzle
Learn Recursion by Solving the Tower of Hanoi Puzzle
Recursion is a programming technique where a function calls itself to solve smaller instances of the same problem. This approach is particularly useful for problems that can be divided into similar subproblems, each of which can be solved independently and combined to form a solution to the original problem.
You'll learn about recursion in detail by building a solution to the Tower of Hanoi puzzle. The Tower of Hanoi is a classic problem that involves moving a stack of disks from one peg to another. The puzzle consists of three rods and several disks of different diameters.
The goal of this puzzle is to move the disks from the first rod to the third rod, subjected to the following constraints:
- Only one disk can be moved at a time.
- A larger disk cannot be placed on top of a smaller disk.
This recursive approach ensures that each step of the puzzle is handled correctly, breaking down the problem into smaller and smaller subproblems until the base case is reached. Thus, the Tower of Hanoi is a clear and classic example of how recursion can simplify and solve complex problems.
@@ -4,6 +4,12 @@ block: learn-regular-expressions-by-building-a-password-generator
superBlock: scientific-computing-with-python
---
## Introduction to Learn Regular Expressions by Building a Password Generator
## Learn Regular Expressions by Building a Password Generator
Learn Regular Expressions by Building a Password Generator
Regular expressions are a powerful tool used for matching patterns within strings. They are a sequence of characters that define a search pattern, primarily used for string searching and validation.
In this project, you'll learn the basics of regular expressions. You'll also learn how to import modules from the Python standard library. A Python module is a file containing Python definitions and statements.
You'll build your password generator that sets complexity requirements using regular expressions. Python's random module is used to generate random numbers within a range. It is also used to shuffle the characters in a string. The strings module is used to get a string containing all ASCII characters, both lowercase and uppercase, digits and punctuation.
With the help of these modules, you'll also see how to create a password with specific strength requirements, such as including numbers, special characters, uppercase letters, and lowercase letters, all using regex patterns.
@@ -6,4 +6,22 @@ superBlock: scientific-computing-with-python
## Introduction to the Learn Special Methods by Building a Vector Space
This is a test for the new project-based curriculum.
Python special methods are called in response to specific operations and enable you to customize the behavior of your objects in a detailed and effective way. These methods, often known as magic methods or dunder methods (due to their double underscores), allow you to define how objects of your custom classes behave with built-in operations like addition, subtraction, comparison, and string representation.
For instance, you can add two instances of a custom class by implementing the `__add__` method like this:
```python
def __add__(self, other):
return MyClass(self.value + other.value)
```
When you add two instances of `MyClass`, Python calls the `__add__` method, which returns a new instance with the sum of the values.
Similarly, you can customize the behavior of other operations by implementing the corresponding special methods. For example, the `__str__` method defines how an object is represented as a string when you call the `str()` function:
```python
def __str__(self):
return f"MyClass instance with value {self.value}"
```
In this project, you are going to explore some of the most common special methods while learning about vectors by building a vector space. By creating vector classes and implementing special methods, you'll learn how to enable operations such as vector addition, subtraction, scalar multiplication, dot products, and comparisons.
@@ -4,6 +4,10 @@ block: learn-string-manipulation-by-building-a-cipher
superBlock: scientific-computing-with-python
---
## Introduction to Learn String Manipulation by Building a Cipher
## Learn String Manipulation by Building a Cipher
Learn String Manipulation by Building a Cipher
A cipher is a method or algorithm for performing encryption or decryption—a process that converts plain text into coded text (ciphertext) and vice versa. The purpose of a cipher is to secure information by making it unreadable to unauthorized users while allowing intended recipients to decode and access the original message.
The project involves writing functions to encrypt and decrypt messages using a custom key. By cycling through the key and shifting characters accordingly, the Vigenère cipher illustrates how text can be transformed into a coded form and then back to its original state. This hands-on approach helps in understanding the principles of encryption and decryption.
Through this project, you will learn key concepts such as string indexing, character manipulation, and the use of modular arithmetic for encoding and decoding text.
@@ -4,6 +4,12 @@ block: learn-the-bisection-method-by-finding-the-square-root-of-a-number
superBlock: scientific-computing-with-python
---
## Introduction to the Learn the Bisection Method by Finding the Square Root of a Number
## Learn the Bisection Method by Finding the Square Root of a Number
This is a test for the new project-based curriculum.
Numerical analysis is essential in scientific computing for solving equations where analytical solutions are not feasible.
This project introduces numerical analysis by finding the square root of a number using the bisection method- a straightforward iterative technique to approximate solutions to problems that are difficult to solve analytically.
By setting an initial range and iteratively narrowing it down based on midpoints, the code converges on an approximate value for the square root. This approach emphasizes the importance of iterative methods and tolerance levels in numerical computations.
Core concepts taught in this project include the implementation of the bisection method, handling edge cases, and understanding convergence criteria in numerical algorithms.
@@ -4,6 +4,10 @@ block: learn-tree-traversal-by-building-a-binary-search-tree
superBlock: scientific-computing-with-python
---
## Introduction to Learn Tree Traversal by Building a Binary Search Tree
## Learn Tree Traversal by Building a Binary Search Tree
Learn Tree Traversal by Building a Binary Search Tree
In computer science, "trees" refer to a data structure that consists of nodes connected by edges. Each node contains a value and may have zero or more child nodes. Tree traversal is a process of visiting each node in a tree data structure exactly once.
Understanding how to create and traverse trees is essential for working with hierarchical data structures. Tree-like data structures organize data for sorting, quick search, insertion, and deletion operations.
In this project, you will gain a deep understanding of how binary search trees function and how traversal techniques can be applied to efficiently access and manipulate tree data structures.