Skip to content

Instantly share code, notes, and snippets.

View codistwa's full-sized avatar

Codistwa codistwa

View GitHub Profile
# ============================================================
# The 3 types of logarithms
# ============================================================
x = np.linspace(-3,3,100)
ln = np.log(x)
decimal = np.log10(x)
binary = np.log2(x)
@codistwa
codistwa / loops.c
Last active February 23, 2022 15:25
Course source code: https://codistwa.com/guides/loops. More courses on https://codistwa.com
// ============================================================
// Simple for loop
// ============================================================
int fruits [3] = {1, 2, 3};
for (int i = 0; i < 3; i++)
printf("%d\n", fruits[i] * 2);
// ============================================================
# ============================================================
# Display of the function
# ============================================================
x = np.linspace(-3,3,100)
plt.plot(x,np.exp(x))
plt.xlabel('x')
plt.ylabel('$e^x$')
// ============================================================
// Recursion with one parameter
// ============================================================
const factorial = (num) => {
if (num === 1) {
return 1;
}
return num * factorial(num - 1);
@codistwa
codistwa / sets.py
Last active February 23, 2022 15:24
Course source code: https://codistwa.com/guides/sets. More courses on https://codistwa.com
# ============================================================
# Definition
# ============================================================
set([0, 1, 2, 3])
# ============================================================
# Add an item
# ============================================================
// ============================================================
// Definition of a variable
// ============================================================
const welcome = 'Hello';
console.log(typeof(welcome)); // string
// ============================================================
// Types
// ============================================================