A repository containing all jupyter notebook files of csq_ipf22 class. It has a table of content for finding the subjects/code-parts/algorithms easier. (And since github is able to render jupyter notebook files on its web page, it's accessible from everywhere).
Note: all of the content here are written by @javadr on one of our classes.
-
- Introducing basic syntax of python (such as defining variables, how to call functions, inputting strings, etc..)
- Basic usage of built-in functions (such as
print,help,input,len) - Introducing
map(int, input().split())syntax to get multiple input from one line. - Introducing Syntax error, Runtime error and Logical error in programming (and python).
- Introducing to usage of single-quotation mark and double-quotation mark.
-
- Introducing usage of
type, differences betweenfloat,int,NoneType, etc... - Introducing usage of
bin,oct,hex, etc... - Learning that
int() base must be >= 2 and <= 36, or 0. - Introducing
mathpackage (import math), basic usage ofmath.sin,math.pi,math.eandmath.tan. - Introducing function definitions (how to define a function header, arguments and return value).
- Introducing fruitful function.
- Introducing to syntax
from something import stuff.
- Introducing usage of
-
- Introducing
min,max,absbuilt-in functions. - Introducing
turtlepackage andturtle.Turtleclass. - Introducing
for something in range(number):syntax (basic for loop). - Defining some functions called
n_angle,square,polygon,circle,arcandrectanglefor turtle - Introducing to how to set speed of the turtle (using
bob.speedmethod). - Introducing python
docstringfeature (which is used for documentations (similar to comments)). - Defining a function called
areawhich calculates the area usingmath.pi. - Introducing usage of
bob.shapemethod (implemented onturtle.Turtleclass).
- Introducing
-
- Introducing some math operators such as
//. - Showing that using
==operator for floats can be dangerous, it's better to compare them like< 10**-20or use some tricks similar to this. - Showing that boolean values (
True/False), are just integers (True == 1,False == 0). - Introducing basic
if...elsesyntax. - Introducing new keyword
pass. - Introducing new logical-boolean operators (such as
and,or,not). - Encountering first
RecursionErrorin our class (by callingtestfunction inside oftestfunction without any stop-condition). - Introducing basic
Recursion(Recursive function). - Defining
factfunction as an example ofRecursionto generate a piece of Factorial series.
- Introducing some math operators such as
-
- Reminder for previous session, redefining
factfunction (an example of recursive). - Showing that
0 * 'string'results in an empty string with length of 0. - Defining function
test_stack_depthwhich has an argument ofdepth(to show maximum depth of stacks). - Re-introducing
map(test, input().split())syntax (which was previously mentioned in first notebook). - Showing that first argument of
mapcan be any function, which will get called on every single thing of its second argument. - Introducing
kochusingturtlemodule.
- Reminder for previous session, redefining
-
- Showing that if we convert a
floatvalue tointvalue, the number after floating-point will be dropped and the result number will become a normal integer. - Introducing
end=andsep=arguments forprintfunction. - Showing how to calculate radical 2 using f(x) and f-prime(x) (
fp(x)). - Introducing
while loop. - Introducing
modoperator (i%2). - Calculating Factorial series (redefining
factfunction) usingforandwhileloops. - Calculating Fibonacci series (defining
fibfunction) usingfor loop. - Calculating Fibonacci series (defining
fibfunction) usingrecursive function(and comparing these two's running time).
- Showing that if we convert a
-
- Introducing string slices.
- Introducing indexes in strings.
- Defining
reversefunction which will reverse a given string (usingfor loop). - Defining
findfunctions will will find a character/sub-str inside of the string (using loops). - Introducing
inoperator. - Introducing common methods defined in str class (such as
count,find,index,strip,lstrip,replace).
-
- Introducing Algorithms, Flowcharts and Problem solving.
- Defining
factandneperfunctions and comparing their running time. - Defining
birthdayfunction which shows how to use.formatmethod on strings to format float types in a string. - Defining
is_completefunction and calculating its running time. - Introducing a mathematic formula for
completenumbers (which is2**(p-1) * (2**p-1), where p is a primary number). - Calculating BMI.
-
- Defining a function called
piwhich calculates and returns thepinumber using a math formula. - Reminder to be careful when doing math operations with
floattypes (for example.1+.1+.1 != .3). - Defining
sum_digitfunction which calculates and returns summary of all of the digits inside of an integer (for example134 --> 1+3+4). - Defining
one_digitizerfunction which callssum_digituntil the result number has only 1 digit (it's less than 10) usingfor loop. - Defining a function called
mehrpooyawhich uses a faster, less-expensive and more efficient algorithm to compute the same thing asone_digitizerfunction. - Defining
rev_numfunction which reverts all digits of a number and returns the result (for example159 --> 951).
- Defining a function called