From f139f3505342e78f88cb1ae7011a80d63f4e4c39 Mon Sep 17 00:00:00 2001
From: briababby57 <96610248+briababby57@users.noreply.github.com>
Date: Mon, 21 Aug 2023 06:01:28 -0500
Subject: [PATCH 01/13] fixed some errors
---
1.2 variables & types/Python.md | 3 +-
2.1-4 ControlFlow.md/2.1 Conditionals.md | 4 ++-
2.1-4 ControlFlow.md/2.2 Lists.md | 12 ++++++--
2.1-4 ControlFlow.md/2.3 Loops.md | 6 ++++
2.1-4 ControlFlow.md/2.4 Functions.md | 5 +++-
2.1-4 ControlFlow.md/Exercises.md | 3 ++
3.1-4DataStructers.md/3.1 Tuples.md | 4 ++-
3.1-4DataStructers.md/3.2 dictionaries.md | 7 ++++-
3.1-4DataStructers.md/3.3 Sets.md | 6 +++-
.../3.4 Exception Handling.md | 5 +++-
3.1-4DataStructers.md/Exercises.md | 2 ++
4.1-3 File IO.md/4.1 file IO.md | 2 ++
4.1-3 File IO.md/4.2 modules.md | 3 ++
4.1-3 File IO.md/4.3 packages.md | 6 +++-
4.1-3 File IO.md/Exercises.md | 2 ++
.../5.1 Classes and objects.md | 7 ++++-
.../5.1 classes & objects.md | 5 ++++
5.1-2 objectoriented.md/5.2 inheritance.md | 6 +++-
5.1-2 objectoriented.md/Exercises.md | 2 ++
6.1-3Libraries.md/6.1 Standard Library.md | 5 ++++
6.1-3Libraries.md/6.2 APIs.md | 3 ++
6.1-3Libraries.md/6.3 Databases.md | 3 ++
6.1-3Libraries.md/Exercises.md | 2 ++
Functions.md | 10 ++++---
MarkdownNotes.md | 30 +++++++++----------
README.md | 5 +++-
26 files changed, 116 insertions(+), 32 deletions(-)
diff --git a/1.2 variables & types/Python.md b/1.2 variables & types/Python.md
index 7e3950c..5e2cde5 100644
--- a/1.2 variables & types/Python.md
+++ b/1.2 variables & types/Python.md
@@ -17,7 +17,8 @@ You dont have ro declare a the type of variable Python will automatically. The m
## 1.3 Basic Arithmetic
Heres the basic arithmetics python accepts:
- - Addition (+)
+
+- Addition (+)
- Subtraction (-)
- Multiplication (*)
diff --git a/2.1-4 ControlFlow.md/2.1 Conditionals.md b/2.1-4 ControlFlow.md/2.1 Conditionals.md
index d4b8d03..46e19ca 100644
--- a/2.1-4 ControlFlow.md/2.1 Conditionals.md
+++ b/2.1-4 ControlFlow.md/2.1 Conditionals.md
@@ -1,5 +1,7 @@
# 2.1
-## If, Elif, Else
+
+## If, Elif, Else
+
__You can use if, elif (short for “else if”), and else to perform different actions based on certain conditions.__
**Here’s a simple example:**
diff --git a/2.1-4 ControlFlow.md/2.2 Lists.md b/2.1-4 ControlFlow.md/2.2 Lists.md
index 2601b2d..15c6190 100644
--- a/2.1-4 ControlFlow.md/2.2 Lists.md
+++ b/2.1-4 ControlFlow.md/2.2 Lists.md
@@ -1,16 +1,24 @@
-# 2.2
+# 2.2
+
## Lists
-A list in Python is a changeable ordered sequence of elements. Each value/ element inside a list is considered a item.
+
+A list in Python is a changeable ordered sequence of elements. Each value/ element inside a list is considered a item.
+
````python
fruits = ["apple", "grapes", "banana"]
````
+
You can access items in a list by referring to their index number, starting at 0.
+
````python
+
print(fruits[0]) # apple
````
+
````python
print(friuts[1]) # grapes
````
+
````python
print(fruits[2]) # banana
````
diff --git a/2.1-4 ControlFlow.md/2.3 Loops.md b/2.1-4 ControlFlow.md/2.3 Loops.md
index 6660abc..ebef07b 100644
--- a/2.1-4 ControlFlow.md/2.3 Loops.md
+++ b/2.1-4 ControlFlow.md/2.3 Loops.md
@@ -1,12 +1,18 @@
# 2.3
+
## Loops
+
### The for loops
+
For loop in Python iterates over an iterable object such as a list:
+
````python
for fruit in fruits:
print(fruit)
````
+
### The While Loop
+
A while loop continues to execute as long as a certain condition is true:
````python
diff --git a/2.1-4 ControlFlow.md/2.4 Functions.md b/2.1-4 ControlFlow.md/2.4 Functions.md
index 68f10d5..a243b0a 100644
--- a/2.1-4 ControlFlow.md/2.4 Functions.md
+++ b/2.1-4 ControlFlow.md/2.4 Functions.md
@@ -1,13 +1,16 @@
# 2.4
+
## Functions
+
Functions in Python are defined using the def keyword. For example, a function that adds two numbers might look like this:
+
````python
def add(x, y):
return x + y
````
You can call this function using its name followed by its arguments in parentheses:
+
````python
print(add(3, 4)) # Outputs: 7
````
-
diff --git a/2.1-4 ControlFlow.md/Exercises.md b/2.1-4 ControlFlow.md/Exercises.md
index 312e66a..e8baa60 100644
--- a/2.1-4 ControlFlow.md/Exercises.md
+++ b/2.1-4 ControlFlow.md/Exercises.md
@@ -1,3 +1,6 @@
+
+# Exercises
+
1. Write an if-elif-else statement for evaluating a variable called grade.
2. Create a list of your three favorite foods, then write a for loop that prints each food on a new line.
3. Write a while loop that prints the numbers from 0 to 9.
diff --git a/3.1-4DataStructers.md/3.1 Tuples.md b/3.1-4DataStructers.md/3.1 Tuples.md
index 2f23035..448d993 100644
--- a/3.1-4DataStructers.md/3.1 Tuples.md
+++ b/3.1-4DataStructers.md/3.1 Tuples.md
@@ -1,7 +1,9 @@
# 3.1
+
## Tuples
+
tuple in Python is similar to a list. The key difference is that tuples are immutable, meaning they cannot be changed after they are created
+
````python
person = ("Alice", 30, "New York")
````
-
diff --git a/3.1-4DataStructers.md/3.2 dictionaries.md b/3.1-4DataStructers.md/3.2 dictionaries.md
index f9c92d0..2a6e611 100644
--- a/3.1-4DataStructers.md/3.2 dictionaries.md
+++ b/3.1-4DataStructers.md/3.2 dictionaries.md
@@ -1,10 +1,15 @@
# 3.2
-## Dictionaries
+
+## Dictionaries
+
A dictionary is a mutable data type that stores keys: values pairs. Here’s an example:
+
````python
person_dict = {"name": "Alice", "age": 30, "city": "New York"
````
+
By referring to the key name you can access the items within a dictionary:
+
````python
print(person_dict["name"]) # Alice
````
diff --git a/3.1-4DataStructers.md/3.3 Sets.md b/3.1-4DataStructers.md/3.3 Sets.md
index 0dae1e9..0f5e09a 100644
--- a/3.1-4DataStructers.md/3.3 Sets.md
+++ b/3.1-4DataStructers.md/3.3 Sets.md
@@ -1,8 +1,12 @@
# 3.3
+
## Sets
-A set is an unordered collection of unique elements.
+
+A set is an unordered collection of unique elements.
It can be used to remove duplicate values from a list, among other things:
+
````python
+
fruits = {"apple", "banana", "cherry", "apple"}
print(fruits) # {'apple', 'cherry', 'banana'}
````
diff --git a/3.1-4DataStructers.md/3.4 Exception Handling.md b/3.1-4DataStructers.md/3.4 Exception Handling.md
index 7e85467..1603a34 100644
--- a/3.1-4DataStructers.md/3.4 Exception Handling.md
+++ b/3.1-4DataStructers.md/3.4 Exception Handling.md
@@ -1,7 +1,10 @@
# 3.4
-## Exception Handling
+
+## Exception Handling
+
Python uses exceptions to handle errors that occur at runtime.
You can use a try/except block to catch exceptions and prevent your program from crashing:
+
````python
try:
print(10 / 0)
diff --git a/3.1-4DataStructers.md/Exercises.md b/3.1-4DataStructers.md/Exercises.md
index e26d0e8..3a6a2af 100644
--- a/3.1-4DataStructers.md/Exercises.md
+++ b/3.1-4DataStructers.md/Exercises.md
@@ -1,3 +1,5 @@
+# Exercises
+
1. Create a tuple containing three elements of different types.
2. Create a dictionary that maps your favorite things to a list of your top three of each.
3. Convert a list with duplicate elements to a set.
diff --git a/4.1-3 File IO.md/4.1 file IO.md b/4.1-3 File IO.md/4.1 file IO.md
index 82f6251..fbe0e72 100644
--- a/4.1-3 File IO.md/4.1 file IO.md
+++ b/4.1-3 File IO.md/4.1 file IO.md
@@ -1,5 +1,7 @@
# 4.1
+
## File I/O
+
Python provides built-in functions for creating, reading, updating, and deleting files.
Here’s how you might create a new file and write some text to it:
diff --git a/4.1-3 File IO.md/4.2 modules.md b/4.1-3 File IO.md/4.2 modules.md
index 9b4dc4f..0be20c9 100644
--- a/4.1-3 File IO.md/4.2 modules.md
+++ b/4.1-3 File IO.md/4.2 modules.md
@@ -1,8 +1,11 @@
# 4.2
+
## Modules
+
a file containing a set of functions that you can include in your application. There are numerous built-in modules in Python, which you can import using the import keyword.
Here’s how you might use the random module to generate a random number:
+
````python
import random
diff --git a/4.1-3 File IO.md/4.3 packages.md b/4.1-3 File IO.md/4.3 packages.md
index f044b83..2c864e0 100644
--- a/4.1-3 File IO.md/4.3 packages.md
+++ b/4.1-3 File IO.md/4.3 packages.md
@@ -1,13 +1,17 @@
# 4.3
-## Packages
+
+## Packages
+
package in Python is a way of organizing related modules into a directory hierarchy. For example, a package might include a collection of modules for handling HTTP requests, processing text, or connecting to a database.
To use a package, you’ll first need to install it (if it’s not part of the Python standard library) using pip:
+
````python
pip install requests
````
You can then import the package or specific components from it:
+
````python
import requests
response = requests.get("https://www.example.com")
diff --git a/4.1-3 File IO.md/Exercises.md b/4.1-3 File IO.md/Exercises.md
index e4f44ad..f61b7aa 100644
--- a/4.1-3 File IO.md/Exercises.md
+++ b/4.1-3 File IO.md/Exercises.md
@@ -1,3 +1,5 @@
+# Exercises
+
1. Write a short text to a file, then read the file and print its contents.
2. Generate a list of 5 random numbers between 1 and 10 using the random module.
3. Use the requests package to get the content of “https://www.example.com” and print the status code.
diff --git a/5.1-2 objectoriented.md/5.1 Classes and objects.md b/5.1-2 objectoriented.md/5.1 Classes and objects.md
index 4e4ba7e..b7dc8ea 100644
--- a/5.1-2 objectoriented.md/5.1 Classes and objects.md
+++ b/5.1-2 objectoriented.md/5.1 Classes and objects.md
@@ -1,8 +1,11 @@
# 5.1
-## Classes and objects
+
+## Classes and objects
+
almost everything is an object, with its properties and methods. A Class is like an object constructor, or a blueprint for creating objects.
Here’s an example of a class:
+
````python
class Person:
def __init__(self, name, age):
@@ -12,9 +15,11 @@ class Person:
def greet(self):
print(f"Hello, my name is {self.name} and I'm {self.age} years old.")
````
+
The __init__ method is a special method that gets called when an object is created. The self keyword refers to the instance of the class and is used to access variables that belongs to the class.
We can create an object of the Person class like this:
+
````python
p = Person("Alice", 30)
p.greet() # Prints: Hello, my name is Alice and I'm 30 years old.
diff --git a/5.1-2 objectoriented.md/5.1 classes & objects.md b/5.1-2 objectoriented.md/5.1 classes & objects.md
index 663cac3..0069007 100644
--- a/5.1-2 objectoriented.md/5.1 classes & objects.md
+++ b/5.1-2 objectoriented.md/5.1 classes & objects.md
@@ -1,8 +1,11 @@
# 5.1
+
## classes and objects
+
almost everything is an object, with its properties and methods. A Class is like an object constructor, or a blueprint for creating objects.
Here’s an example of a class:
+
````python
class Person:
def __init__(self, name, age):
@@ -12,9 +15,11 @@ class Person:
def greet(self):
print(f"Hello, my name is {self.name} and I'm {self.age} years old.")
````
+
The __init__ method is a special method that gets called when an object is created. The self keyword refers to the instance of the class and is used to access variables that belongs to the class.
We can create an object of the Person class like this:
+
````python
p = Person("Alice", 30)
p.greet() # Prints: Hello, my name is Alice and I'm 30 years old.
diff --git a/5.1-2 objectoriented.md/5.2 inheritance.md b/5.1-2 objectoriented.md/5.2 inheritance.md
index ffa89ab..f46c28d 100644
--- a/5.1-2 objectoriented.md/5.2 inheritance.md
+++ b/5.1-2 objectoriented.md/5.2 inheritance.md
@@ -1,10 +1,13 @@
# 5.2
-# Inheritance
+
+## Inheritance
+
allows us to define a class that inherits all the methods and properties from another class.
The class from which properties and methods are inherited is called the parent class, and the class that inherits from the parent class is called the child class.
Here’s an example:
+
````python
class Student(Person):
def __init__(self, name, age, grade):
@@ -14,5 +17,6 @@ class Student(Person):
def introduce(self):
print(f"Hello, my name is {self.name}, I'm {self.age} years old and I'm in grade {self.grade}.")
````
+
In this example, Student is a child class that inherits from the Person parent class.
The super().__init__(name, age) call is used to call the __init__ method of the parent class.
diff --git a/5.1-2 objectoriented.md/Exercises.md b/5.1-2 objectoriented.md/Exercises.md
index 5e89433..54c3061 100644
--- a/5.1-2 objectoriented.md/Exercises.md
+++ b/5.1-2 objectoriented.md/Exercises.md
@@ -1,3 +1,5 @@
+# Exercises
+
1. Create a Car class with properties like brand, model, and year, and methods to perform operations like start and stop.
2. Create an object of your Car class and call its methods.
3. Create a Tesla class that inherits from your Car class. Add an additional property like autopilot and an additional method to activate it.
diff --git a/6.1-3Libraries.md/6.1 Standard Library.md b/6.1-3Libraries.md/6.1 Standard Library.md
index 2b2ad32..49e837c 100644
--- a/6.1-3Libraries.md/6.1 Standard Library.md
+++ b/6.1-3Libraries.md/6.1 Standard Library.md
@@ -1,14 +1,19 @@
# 6.1
+
## Python Standard Library
+
is a collection of modules that provides implementations of common functionalities and allows you to perform a variety of tasks without the need to install any additional libraries.
For example, the math module provides mathematical functions:
+
````python
import math
print(math.sqrt(16)) # Prints: 4.0
````
+
The datetime module provides functions for manipulating dates and times:
+
````python
import datetime
diff --git a/6.1-3Libraries.md/6.2 APIs.md b/6.1-3Libraries.md/6.2 APIs.md
index c0b1d29..dafdbb6 100644
--- a/6.1-3Libraries.md/6.2 APIs.md
+++ b/6.1-3Libraries.md/6.2 APIs.md
@@ -1,8 +1,11 @@
# 6.2
+
## Working with APIs
+
Application Programming Interfaces, are a set of rules and protocols for building and interacting with software applications. APIs can be used to interact with other software components.
Here’s a simple example using the requests module to fetch data from a web API:
+
````python
import requests
diff --git a/6.1-3Libraries.md/6.3 Databases.md b/6.1-3Libraries.md/6.3 Databases.md
index e8c962f..e811f00 100644
--- a/6.1-3Libraries.md/6.3 Databases.md
+++ b/6.1-3Libraries.md/6.3 Databases.md
@@ -1,6 +1,9 @@
# 6.3
+
## Databases
+
Python provides several libraries to connect to and interact with databases. SQLite is a simple file-based database included in Python’s standard library:
+
````python
import sqlite3
diff --git a/6.1-3Libraries.md/Exercises.md b/6.1-3Libraries.md/Exercises.md
index 5bf1525..8de94ea 100644
--- a/6.1-3Libraries.md/Exercises.md
+++ b/6.1-3Libraries.md/Exercises.md
@@ -1,3 +1,5 @@
+# Exercises
+
1. Use the math module to calculate the factorial of a number.
Use the datetime module to get the current date and time and format it in the ‘YYYY-MM-DD HH:MM:SS’ format.
2. Use the requests module to fetch data from ‘https://jsonplaceholder.typicode.com/posts’ and print the title of each post.
diff --git a/Functions.md b/Functions.md
index 870de7a..c866e70 100644
--- a/Functions.md
+++ b/Functions.md
@@ -7,11 +7,11 @@ we can use many features such as decorator, annotation, docstrings, default
arguments and so on to define a function. In this cheat sheet, it collects
many ways to define a function and demystifies some enigmatic syntax in functions.
-
.. contents:: Table of Contents
:backlinks: none
Functions
+
------------------
Documentation provides programmers hints about how a function is supposed to
be used. A docstring gives an expedient way to write a readable document of
@@ -29,9 +29,8 @@ format of docstrings.
...
>>> example.__doc__
'This is an example function.'
- >>> help(example)
+ >>> help(example)
-
Option Arguments
----------------
@@ -57,7 +56,9 @@ Unpack Arguments
...
>>> foo(*("FOO", "BAR"), **{"c": "baz"})
FOO BAR baz
+
Keyword-Only Arguments
+
----------------------
**New in Python 3.0**
@@ -72,7 +73,8 @@ Keyword-Only Arguments
>>> f(1, 2, 3)
Traceback (most recent call last):
File " All languanges technicallg have syntax. **All** languanges technicallg have syntax. HTML is a collection of elements. A combination of elements are used to build a webpage. **All** languanges technicallg have syntax. To sum HTML up in one word I would say ELEMENTS!! ALL languanges technicallg have syntax. HTML is a collection of elements. A combination of elements are used to build a webpage. To sum HTML up in one word I would say ELEMENTS!! ALL languanges technicallg have syntax. Welcome to The Code Guide
+ Welcome to The Code Guide As CoWik
HTML is a collection of elements. A combination of elements are used to build a webpage.