Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bodnár Zsombor
python-kszkepzes
Commits
fc53258a
Commit
fc53258a
authored
Mar 27, 2019
by
Bodor Máté
Browse files
v0.17
parent
88f60e4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
PITCHME.md
View file @
fc53258a
# Python3
# Python3
alapok
```
python
```
python
import
this
import
this
...
@@ -172,7 +172,7 @@ pip install flake8
...
@@ -172,7 +172,7 @@ pip install flake8
Note
:
Note
:
-
Dependen
s
y, egy csomag több verzió
-
Dependen
c
y, egy csomag több verzió
+++
+++
...
@@ -246,7 +246,7 @@ print('back to normal now')
...
@@ -246,7 +246,7 @@ print('back to normal now')
---
---
### Szintaxis
### Szintaxis
TODO
```
python
```
python
#!/usr/bin/python3
#!/usr/bin/python3
...
@@ -322,7 +322,9 @@ stringabc
...
@@ -322,7 +322,9 @@ stringabc
+++
+++
-
bármilyen típus lehet benne
-
bármilyen típus tartalmazhat (általában egyforma)
-
Az elemek indexelhetőek
-
módosítható(mutable)
-
módosítható(mutable)
...
@@ -427,6 +429,48 @@ def fibonacci(n):
...
@@ -427,6 +429,48 @@ def fibonacci(n):
else
:
return
F
(
n
-
1
)
+
F
(
n
-
2
)
else
:
return
F
(
n
-
1
)
+
F
(
n
-
2
)
```
```
+++
-
Opciónális paraméter
```
python
def
fibonacci
(
n
=
10
):
if
n
==
0
:
return
0
elif
n
==
1
:
return
1
else
:
return
F
(
n
-
1
)
+
F
(
n
-
2
)
```
+++
-
Tetszőlegesen sok paraméter
```
python
def
minimum
(
first
,
*
args
):
# *args néven szokás
acc
=
first
for
x
in
args
:
if
x
<
acc
:
acc
=
x
return
acc
print
(
minimum
(
3
,
4
,
2
,
-
8
,
6
))
```
+++
-
névszerinti paraméterátadás
```
python
def
print_rectangle
(
w
=
0
,
h
=
0
,
x
=
0
,
y
=
0
):
print
(
"Rectangle"
)
print
(
"- size: {}×{}"
.
format
(
w
,
h
))
print
(
"- position: ({};{})"
.
format
(
x
,
y
))
print_rectangle
(
20
,
30
,
40
,
50
)
print_rectangle
(
x
=
10
,
w
=
19
,
h
=
25
)
```
+++
---
---
### Alap beépített fgv-ek
### Alap beépített fgv-ek
...
@@ -456,55 +500,70 @@ range
...
@@ -456,55 +500,70 @@ range
+++
+++
```
python
```
python
count
=
0
i
=
1
while
(
count
<
9
)
:
while
i
<
6
:
print
(
'The count is:'
,
count
)
print
(
i
)
count
=
count
+
1
i
+
=
1
```
```
Output:
```
python
```
python
>>>
range
(
5
)
1
range
(
0
,
5
)
2
>>>
list
(
range
(
5
))
3
[
0
,
1
,
2
,
3
,
4
]
4
5
```
```
---
---
###
#
For
### For
(each)
+++
+++
```
python
```
python
for
var
in
range
(
5
):
a
=
[
1
,
2
,
3
]
print
(
var
)
for
x
in
a
:
print
(
x
)
print
(
"-"
)
for
x
in
range
(
1
,
6
,
2
):
# for (int i = 1; i < 6; i += 2)
print
(
x
)
```
```
```
python
Output:
for
letter
in
'Python'
:
# traversal of a string sequence
print
(
'Current Letter :'
,
letter
)
print
()
fruits
=
[
'banana'
,
'apple'
,
'mango'
]
for
fruit
in
fruits
:
# traversal of List sequence
```
python
print
(
'Current fruit :'
,
fruit
)
1
2
3
-
1
3
5
```
```
---
---
### Elágazások
### Elágazások
+++
```
python
```
python
if
expression1
:
b
=
False
statement
(
s
)
x
=
3
el
if
expression2
:
if
not
b
and
x
<=
6
:
statement
(
s
)
print
(
"Hello"
)
elif
expression3
:
elif
b
or
x
>
5
:
statement
(
s
)
print
(
"World!"
)
else
:
else
:
statement
(
s
)
print
(
"Hello World!"
)
```
Output:
```
python
Hello
```
```
---
---
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment