Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 112 additions & 2 deletions .ipynb_checkpoints/Python-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -1,6 +1,116 @@
{
"cells": [],
"metadata": {},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"# Python 3.x Tutorial"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Python\n",
"Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and [dynamic typing](http://c2.com/cgi/wiki?DynamicTyping), together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.\n",
"Like Java, Python is also an [interpreted](http://www.codeproject.com/Articles/696764/Differences-between-compiled-and-Interpreted-Langu) programming language."
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"### Python 3.x\n",
"\n",
"Current tutorial will be focused on Python 3.x . Python 3.x is the present and future of the language."
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"## Interpreter and Interactive shell\n",
"Python is an interpreted language and comes with an interactive shell.The interactive shell is interactive in the way that it stands between the commands or actions and their execution.\n",
"\n",
"To fire up the interactive shell,type :\n",
"~~~~\n",
"$ python3\n",
"~~~~\n",
"in the terminal on your machine. If Python 3.x is succesfully installed on your machine, you should get such kind of output.\n",
"~~~~\n",
"Python 3.5.1+ (default, Mar 30 2016, 22:46:26) \n",
"[GCC 5.3.1 20160330] on linux\n",
"Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n",
">>> \n",
"~~~~\n",
"type \n",
"~~~~\n",
">>> exit()\n",
"~~~~ \n",
"to quit the interactive shell."
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"## Data types and variables\n",
"### **What is a variable ?**\n",
"\n",
"\n",
"A variable is something which can change. A variable is a way of referring to a memory location used by a computer program.In many programming languages a variable is a symbolic name for this physical location. This memory location contains values, like numbers, text or more complicated types. We can use this variable to tell the computer to save some data in this location or to retrieve some data from this location. \n",
"\n",
"### **How to create a variable in Python ?**\n",
"\n",
"\n",
"You create a varible in Python by the the following syntax.\n",
"\n",
"\n",
"**variable_name = variable_value**\n",
"`my_variable = 90`\n",
"Here we have created a variable with identifier name as *my_variable* and has assigned a value of *10* to it.\n",
"\n",
"#### **How to print something in Python ?**\n",
"Python comes with a built in command `print` to print something on the interactive shell.\n",
"type `print(\"Hello world!\")` in the interactive shell, after this you'll see a message; **Hello world!**.\n",
"Similarly to print the variable *my_variable* that we created before, type `print(my_variable)`, you will see a message saying **90**.\n",
"\n",
"If something like a prompt comes up, similar like this :\n",
"~~~~\n",
"Traceback (most recent call last):\n",
"NameError: name 'my_variable' is not defined\n",
"~~~~ \n",
"this means that we have not defined the variable *my_variable* in Python."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.3+"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
108 changes: 84 additions & 24 deletions Python.ipynb
Original file line number Diff line number Diff line change
@@ -1,49 +1,109 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Python 3.x Tutorial"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Basic"
"## Python\n",
"Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and [dynamic typing](http://c2.com/cgi/wiki?DynamicTyping), together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.\n",
"Like Java, Python is also an [interpreted](http://www.codeproject.com/Articles/696764/Differences-between-compiled-and-Interpreted-Langu) programming language."
]
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"collapsed": true
},
"source": [
"## Data Types"
"### Python 3.x\n",
"\n",
"Current tutorial will be focused on Python 3.x . Python 3.x is the present and future of the language."
]
},
{
"cell_type": "code",
"execution_count": 1,
"cell_type": "markdown",
"metadata": {
"collapsed": false
"collapsed": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"5 Test True\n"
]
}
],
"source": [
"my_num = 5\n",
"my_strin = \"Test\"\n",
"my_bool = True\n",
"print(my_num,my_strin,my_bool)"
"## Interpreter and Interactive shell\n",
"Python is an interpreted language and comes with an interactive shell.The interactive shell is interactive in the way that it stands between the commands or actions and their execution.\n",
"\n",
"To fire up the interactive shell,type :\n",
"~~~~\n",
"$ python3\n",
"~~~~\n",
"in the terminal on your machine. If Python 3.x is succesfully installed on your machine, you should get such kind of output.\n",
"~~~~\n",
"Python 3.5.1+ (default, Mar 30 2016, 22:46:26) \n",
"[GCC 5.3.1 20160330] on linux\n",
"Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n",
">>> \n",
"~~~~\n",
"type \n",
"~~~~\n",
">>> exit()\n",
"~~~~ \n",
"to quit the interactive shell."
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
"source": [
"## Data types and variables\n",
"### **What is a variable ?**\n",
"\n",
"\n",
"A variable is something which can change. A variable is a way of referring to a memory location used by a computer program.In many programming languages a variable is a symbolic name for this physical location. This memory location contains values, like numbers, text or more complicated types. We can use this variable to tell the computer to save some data in this location or to retrieve some data from this location. \n",
"\n",
"### **How to create a variable in Python ?**\n",
"\n",
"\n",
"You create a varible in Python by the the following syntax.\n",
"\n",
"\n",
"**variable_name = variable_value**\n",
"`my_variable = 90`\n",
"Here we have created a variable with identifier name as *my_variable* and has assigned a value of *10* to it.\n",
"\n",
"#### **How to print something in Python ?**\n",
"Python comes with a built in command `print` to print something on the interactive shell.\n",
"type `print(\"Hello world!\")` in the interactive shell, after this you'll see a message; **Hello world!**.\n",
"Similarly to print the variable *my_variable* that we created before, type `print(my_variable)`, you will see a message saying **90**.\n",
"\n",
"If something like a prompt comes up, similar like this :\n",
"~~~~\n",
"Traceback (most recent call last):\n",
"NameError: name 'my_variable' is not defined\n",
"~~~~ \n",
"this means that we have not defined the variable *my_variable* in Python.\n",
"\n",
"\n",
"#### **How are variables stored in memory?** \n",
"This section is especially intended for C, C++ and Java programmers, because the way these programming languages treat basic data types is different from the way Python does it. Those who start learning Python as their first programming language may skip to the next section. \n",
"\n",
"\n",
"In Python,a variable can be seen as a container (or some say a pigeonhole) to store certain values. While the program is running, variables are accessed and sometimes changed, i.e. a new value will be assigned to a variable. \n",
"By changing of value of a variable we mean that old value is removed and now the container i.e the variable now contains the new value.\n",
"For C++ and Java programmers the above concept of how variables are stored in memory might be different from the way they are stored in C++ and Java.\n",
"\n",
"Putting values into the variables can be realized with assignments. The way you assign values to variables is nearly the same in all programming languages. In most cases the equal \"=\" sign is used. The value on the right side will be saved in the variable name on the left side. \n",
"\n"
]
}
],
"metadata": {
Expand All @@ -62,7 +122,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.1"
"version": "3.4.3+"
}
},
"nbformat": 4,
Expand Down
72 changes: 61 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,70 @@
# Python 3.x Tutorial

# Basic
## Python
Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and [dynamic typing](http://c2.com/cgi/wiki?DynamicTyping), together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.
Like Java, Python is also an [interpreted](http://www.codeproject.com/Articles/696764/Differences-between-compiled-and-Interpreted-Langu) programming language.

## Data Types
### Python 3.x

Current tutorial will be focused on Python 3.x . Python 3.x is the present and future of the language.

```python
my_num = 5
my_strin = "Test"
my_bool = True
print(my_num,my_strin,my_bool)
```

5 Test True
## Interpreter and Interactive shell
Python is an interpreted language and comes with an interactive shell.The interactive shell is interactive in the way that it stands between the commands or actions and their execution.

To fire up the interactive shell,type :
~~~~
$ python3
~~~~
in the terminal on your machine. If Python 3.x is succesfully installed on your machine, you should get such kind of output.
~~~~
Python 3.5.1+ (default, Mar 30 2016, 22:46:26)
[GCC 5.3.1 20160330] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
~~~~
type
~~~~
>>> exit()
~~~~
to quit the interactive shell.


```python
## Data types and variables
### **What is a variable ?**


A variable is something which can change. A variable is a way of referring to a memory location used by a computer program.In many programming languages a variable is a symbolic name for this physical location. This memory location contains values, like numbers, text or more complicated types. We can use this variable to tell the computer to save some data in this location or to retrieve some data from this location.

### **How to create a variable in Python ?**


You create a varible in Python by the the following syntax.


**variable_name = variable_value**
`my_variable = 90`
Here we have created a variable with identifier name as *my_variable* and has assigned a value of *10* to it.

#### **How to print something in Python ?**
Python comes with a built in command `print` to print something on the interactive shell.
type `print("Hello world!")` in the interactive shell, after this you'll see a message; **Hello world!**.
Similarly to print the variable *my_variable* that we created before, type `print(my_variable)`, you will see a message saying **90**.

If something like a prompt comes up, similar like this :
~~~~
Traceback (most recent call last):
NameError: name 'my_variable' is not defined
~~~~
this means that we have not defined the variable *my_variable* in Python.

#### **How are variables stored in memory?**
This section is especially intended for C, C++ and Java programmers, because the way these programming languages treat basic data types is different from the way Python does it. Those who start learning Python as their first programming language may skip to the next section.


In Python,a variable can be seen as a container (or some say a pigeonhole) to store certain values. While the program is running, variables are accessed and sometimes changed, i.e. a new value will be assigned to a variable.
By changing of value of a variable we mean that old value is removed and now the container i.e the variable now contains the new value.
For C++ and Java programmers the above concept of how variables are stored in memory might be different from the way they are stored in C++ and Java.

Putting values into the variables can be realized with assignments. The way you assign values to variables is nearly the same in all programming languages. In most cases the equal "=" sign is used. The value on the right side will be saved in the variable name on the left side.

```