آشنایی با پایتون

کلیدهای میانبر

1) ESC ============> فعال سازی کلیدهای میانبر

2) ESC + h =========>راهنمای (کمکی) کلیدهای میانبر

3) ESC + a =========> create a cell above

4) ESC + b =========> create a cell below

5) ESC + dd ========> delete cell

6) ESC + z =========> undo (ESC + Command + Z redo)

7) SHIFT + ENTER ===> run the cell

8) Command + / =====> comment (again uncomment)

دستور چاپ یا پرینت

عملیات ساده ماشین حسابی با پایتون

متغییرها و انواع آنها

چاپ با فرمت و بدون فرمت

A similar feature can be used for integers:

g outputs a floating point number in the most compact form:

تبدیل نوع متغیرها از نوعی به نوع دیگر

رنجها، لیستها، توپلزها، دیکشنریها، و آریه ها

Ranges, Lists, Tuples, Dictionaries, and Arrays

Ranges

Lists

Tuple

Lists are a flexible and user-friendly way to store sequences of numbers, and are used in nearly all Python programs. However, a few other data types are also made to store sequences of data. One of the most important ones is called a tuple, and it is essentially a constant list that cannot be changed. A tuple is defined in almost the same way as a list, but with normal parentheses instead of the square brackets. Alternatively, we can skip the parentheses and just use a comma-separated sequence of values to define a tuple.

تفاوت بین لیست و توپل چیست؟

خطای فوق به این دلیل روی داده است که ما نمی توانیم به توپل اضافه یا از آن حذف کنیم ولی به لیست می توانیم

Dictionary

Array using NumPy Library

NumPy is a library for the Python programming language, adding support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays

NumPy offers comprehensive mathematical functions, random number generators, linear algebra routines, Fourier transforms, and more

تفاوت بین آرایه و لیست چیست؟

مجموعه

A set is like a dictionary withouth keys.

Linspace

Creating Ranges of Numbers With Even Spacing

np.linspace(): Create Evenly or Non-Evenly Spaced Arrays

Plotting using matplotlib

Matplotlib is a plotting library for the Python programming language and its numerical mathematics extension NumPy. It provides an object-oriented API for embedding plots into applications using general-purpose GUI toolkits like Tkinter, wxPython, Qt, or GTK.

https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.plot.html fig14.png