Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d92d323

Browse files
Merge pull request #2 from digitronik/begin
some review changes for beginning.md
2 parents abd95cc + 3277ebf commit d92d323

File tree

1 file changed

+66
-66
lines changed

1 file changed

+66
-66
lines changed

‎beginning.md

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# The Beginning
22

3-
## Using Python interpreter
3+
## [Using Python interpreter](https://docs.python.org/3/tutorial/interpreter.html)
44

5-
* Type 'python3' command in terminal to open python interpreter
5+
* Type `python3` command in terminal to open a Python Interpreter.
66

77
```
88
[raukadah@ironman python-workshop]$ python3
@@ -11,44 +11,47 @@ Python 3.7.3 (default, Mar 27 2019, 13:36:35)
1111
Type "help", "copyright", "credits" or "license" for more information.
1212
>>>
1313
```
14-
* *>>>* knowns as python prompt
15-
* Use CTRL + D to exit from the terminal
14+
* `>>>` is known as python prompt.
15+
* Use `CTRL + d` to exit from the terminal or `exit()` command.
1616
* After quitting, all programs will get destroyed.
1717

1818
## My first program
19-
* *print()* method is used to display output to the use
19+
* `print()` method is used to display output like `printf` in *C language*.
20+
2021
```
2122
>>> print('Welcome to FOSSMEET, PUNE')
2223
Welcome to FOSSMEET, PUNE
2324
```
2425

25-
* We can also print in multiple lines by using *\n*.
26+
* We can also print in multiple lines by using `\n`.
2627
```
2728
>>> print('Welcome to FOSSMEET, PUNE\n Let\'s Learn Python 3')
2829
Welcome to FOSSMEET, PUNE
2930
Let's Learn Python 3
3031
```
3132
We can *\* to escape any characters.
3233

33-
## Use *#* to comment the code
34-
Anything written afer *#* will be ignored.
34+
## [Use *#* to comment the code](https://www.python.org/dev/peps/pep-0008/#comments)
35+
Anything written after `#` will be ignored.
3536
```
3637
>>> # print('This is a comment')
3738
...
3839
>>>
3940
```
4041

4142
## Variables
42-
* Variables in Python allows us to store information and give it a label
43-
we can use to retrieve that information later.
43+
* Variables in Python allows us to store information and give it a label.
44+
We can use to retrieve that information later.
45+
46+
* We can store numbers, strings (*a sequence of characters*) and complex data
47+
types.
4448

45-
* We can store numbers, strings (a squenece of characters) and complex data
46-
types
4749
* We assign values to variables by putting the value to the right of an equal
4850
sign.
49-
* Since Python is a dynamic language so we donot need to define the data type of
50-
a variable.
51-
* Let's define a varibale.
51+
52+
* Python is a [General purpose programming language](https://en.wikipedia.org/wiki/General-purpose_programming_language).
53+
54+
* Let's define a variable.
5255
```
5356
>>> a = 12 # *a* is a variable holding the value 2
5457
>>> b = 'Hello' # *b* is another variable holding string
@@ -58,9 +61,9 @@ Anything written afer *#* will be ignored.
5861
'Hello'
5962
>>>
6063
```
61-
* variable can be called any times based on needs.
64+
* Variable can be called any times based on needs.
6265

63-
## String representation
66+
## [String representation](https://docs.python.org/3/tutorial/introduction.html#strings)
6467
* We can represent string using single, double or triple quotes.
6568
```
6669
>>> a = 'Hello World'
@@ -79,18 +82,18 @@ Anything written afer *#* will be ignored.
7982
8083
It is a multi line string
8184
Have fun, when we print it
82-
8385
>>>
8486
```
85-
* We can *print* method to display the output.
87+
* We can `print` method to display the output.
8688

87-
## Whitespaces and Identation
88-
* We gives whitespaces between operators to make code more readable.
89+
## [Whitespaces and Indentation](https://docs.python.org/2.0/ref/indentation.html)
90+
* We give whitespaces between operators to make the code more readable.
8991
* Space at the beginning of a line is known as indentation.
90-
* On using wrong indentation, it will give indentation error
92+
* On using the wrong indentation, it will give indentation error
9193
* Let's see
9294
```
9395
>>> a = 'foobar'
96+
9497
>>> a = 'foobar'
9598
File "<stdin>", line 1
9699
a = 'foobar'
@@ -100,7 +103,7 @@ IndentationError: unexpected indent
100103
```
101104

102105
## Variable Naming
103-
* Name of the variable should be meaningfull.
106+
* Name of the variable should be meaningful.
104107
* We generally use Number, Characters and underscore for naming
105108
variables.
106109
* On using special characters it will through error.
@@ -114,7 +117,7 @@ IndentationError: unexpected indent
114117
^
115118
SyntaxError: invalid syntax
116119
```
117-
* Python provides a list of keywords which cannot be used a variable name.
120+
* Python provides a list of `keywords` which can't be used a variable name.
118121

119122
## Multiple assignment in a single line
120123
We can even assign multiple values in a single line.
@@ -148,13 +151,13 @@ We can even assign multiple values in a single line.
148151
>>> (10 * 20 / 2 -100 ) + 50 # We can call it as a expression
149152
50.0
150153
```
151-
* *+, -, *, /* are used for addition, substraction, multiplication and
154+
* `+`, `-`, `*`, `/` are used for addition, substraction, multiplication and
152155
division.
153-
* '**' for calculating powers
154-
* '/' returns floating point numbers
155-
* '//' is used to discard fractional part.
156-
* We can also try BODMAS rule in a expression
157-
* These are known as arithmetic operators
156+
* `**` for calculating powers.
157+
* `/` returns floating point numbers.
158+
* `//` is used to discard fractional part.
159+
* We can also try `BODMAS` rule in an expression.
160+
* These are known as arithmetic operators.
158161

159162
## Relational Operators
160163
```
@@ -172,10 +175,10 @@ True
172175
True
173176
```
174177

175-
## Logical operator
176-
* *and* and *or* are logical operator
177-
* x and y returns False if x is False else it returns evaluation of y.
178-
If x is True, it returns True.
178+
## Logical Operator
179+
* `and` and `or` are a logical operator.
180+
* `x` and `y` returns `False` if `x` is `False` else it returns evaluation of `y`.
181+
If `x` is `True`, it returns `True`.
179182
```
180183
>>> 1 and 4
181184
4
@@ -189,8 +192,8 @@ True
189192
0
190193
```
191194

192-
## Shorthand operator
193-
* *x op = expression* is the syntax for shorthand operators.
195+
## Shorthand Operator
196+
* `x operator = expression` is the syntax for shorthand operators.
194197
```
195198
>>> a = 15
196199
>>> b += 30
@@ -199,7 +202,7 @@ True
199202
```
200203

201204
## Taking input from keyword
202-
* *input()* method is used to take input from keyboard
205+
* `input()` method is used to take `input` from `keyboard`.
203206
```
204207
>>> input("Enter your name: ")
205208
Enter your name: Chandan Kumar
@@ -210,9 +213,9 @@ Enter your name: raukadah
210213
'raukadah'
211214
>>>
212215
```
213-
## type conversion
214-
* we can use *type()* to check the data type of a variable
215-
* we can also convert it
216+
## Type conversion
217+
* We can use `type()` to check the data type of a variable.
218+
* We can also convert it.
216219
```
217220
>>> a = 10
218221
>>> c = 1.5
@@ -256,30 +259,29 @@ TypeError: cannot concatenate 'str' and 'int' objects
256259
```
257260

258261
## Writting a program in file
259-
* All programs are written with *<filename>.py*
260-
* Open a file named *first_program.py* and write the following
261-
code.
262+
* All programs are written with `<filename>.py`.
263+
* Create a file named `first_program.py` and write the following code.
262264
```
263265
#!/usr/bin/env python3
264266
265267
myname = input("Enter your name: ")
266268
print('Welcome to Python3 Fun Class %s' % myname)
267269
```
268-
* Make the program executable
270+
* Make the program executable.
269271
```
270272
$ chomd +x first_program.py
271273
```
272-
* Then run it
274+
* Then run it.
273275
```
274276
$./first_program.py
275277
```
276-
* On the first line you can #!, what we call it sha-bang.
277-
The sha-bang indicates that the Python interpreter should run this code.
278+
* On the first line you can `#!`, what we call it [sha-bang](https://en.wikipedia.org/wiki/Shebang_(Unix).
279+
The `sha-bang` indicates that the Python interpreter should run this code.
278280

279-
## Decision Making using if,else
280-
While working on programs, we always encounted with making decisions.
281-
Based on condition, we need to perform tasks or do other tasks.
282-
We can *if* keyword to that.
281+
## Decision Making using if,else
282+
While working on programs, we always encounter with making decisions.
283+
Based on the condition, we need to perform tasks or do other tasks.
284+
We can use `if` keyword to that.
283285
```
284286
if expression:
285287
do
@@ -310,18 +312,18 @@ if a:
310312
```
311313

312314
## Functions
313-
* When we have to do a certain set of operatin multiple times and reuse it
314-
with in codebase then we need to define a function
315-
* *def* keyword is used to define a function
316-
* syntex
315+
* When we have to do a certain set of operation multiple times and reuse it
316+
with in codebase then we need to define a function.
317+
* `def` keyword is used to define a function.
318+
* Syntax:
317319
```
318320
def function_name(function_arguments):
319321
do some stuff
320322
return something
321323
```
322324
* Here function_arguments are not necessary.
323325
* function arguments can be passed in any fashion
324-
* if return is not define, it will not return anything.
326+
* If return is not define, it will not return anything (None).
325327
```
326328
>>> def sum(a, b):
327329
... print(a + b)
@@ -356,13 +358,13 @@ None
356358
```
357359

358360
### For loop
359-
In python loop works over sequence.
360-
Sequence might be a list, string, tuples or dictionary.
361+
In Python loop works over a `Iterator` object.
362+
might be a `list`, `string`, `tuples`, `dictionary`, `set` etc.
361363
```
362364
for i in sequence:
363365
do some stuff
364366
```
365-
Let's print the letter of a word.
367+
Let's `print` the letter of a word.
366368
```
367369
>>> word = "fossmeet"
368370
>>> for i in word:
@@ -372,11 +374,11 @@ f*o*s*s*m*e*e*t*
372374
```
373375

374376
### Looping over integers
375-
* Use range() function
376-
* range() can be used in three ways
377-
* range(n): will contain numbers form 0 through n-1
378-
* range(x, y): will start from x and end at y - 1
379-
* range(x, y, z): will start at x and continue as x + z, x + 2z until x + kz is less than y
377+
* Use `range()` function.
378+
* `range()` can be used in three ways.
379+
* `range(n)`: will contain numbers form `0` through `n-1`
380+
* `range(x, y)`: will start from `x` and end at `y-1`
381+
* `range(x, y, z)`: will start at `x` and continue as `x+z`, `x+2z` until `x+kz` is less than `y`.
380382
```
381383
>>> range(10)
382384
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
@@ -400,5 +402,3 @@ f*o*s*s*m*e*e*t*
400402
8 square is 64
401403
9 square is 81
402404
```
403-
404-
## Time to learn some more stuff

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /