Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python-kszkepzes
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bodzsoaa
python-kszkepzes
Commits
2f1270e9
Commit
2f1270e9
authored
Mar 28, 2019
by
Bodor Máté
Browse files
Options
Downloads
Patches
Plain Diff
v0.22
parent
1bb5c913
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
PITCHME.md
+200
-85
200 additions, 85 deletions
PITCHME.md
with
200 additions
and
85 deletions
PITCHME.md
+
200
−
85
View file @
2f1270e9
...
...
@@ -2,6 +2,7 @@
```
python
import
this
```
---
...
...
@@ -162,7 +163,7 @@ Note:
+++
```
bash
pip
install
flake8
pip
install
<package>
```
---
...
...
@@ -210,6 +211,16 @@ source venv/bin/activate
-
Rossz formázás
-
pep8(Style Guide)
```
cmd
pip install black
```
```
cmd
flake8 <filename>
```
Note:
-
Style Guide
...
...
@@ -219,12 +230,27 @@ Note:
---
### Black
-
Atomatikusan formázza a kódot.
```
cmd
pip install black
```
```
cmd
black <filename>
```
---
### Hello World
+++
```
python
print
(
"
Hello World!
"
)
```
+++
...
...
@@ -238,11 +264,12 @@ from colorama import init
from
colorama
import
Fore
,
Back
,
Style
init
()
print
(
Fore
.
RED
+
'
some red text
'
)
print
(
Back
.
GREEN
+
'
and with a green background
'
)
print
(
Style
.
DIM
+
'
and in dim text
'
)
print
(
Fore
.
RED
+
"
some red text
"
)
print
(
Back
.
GREEN
+
"
and with a green background
"
)
print
(
Style
.
DIM
+
"
and in dim text
"
)
print
(
Style
.
RESET_ALL
)
print
(
'
back to normal now
'
)
print
(
"
back to normal now
"
)
```
---
...
...
@@ -250,18 +277,19 @@ print('back to normal now')
### Szintaxis
```
python
'''
This is the start of the program
'''
"""
This is the start of the program
"""
while
1
:
print
(
'
Spam
'
)
answer
=
input
(
'
Press y for large fries
'
)
if
answer
==
'
y
'
:
print
(
'
Large fries with spam, mmmm, yummy
'
)
print
(
"
Spam
"
)
answer
=
input
(
"
Press y for large fries
"
)
if
answer
==
"
y
"
:
print
(
"
Large fries with spam, mmmm, yummy
"
)
continue
answer
=
input
(
'
Had enough yet?
'
)
if
answer
==
'
y
'
:
answer
=
input
(
"
Had enough yet?
"
)
if
answer
==
"
y
"
:
break
print
(
'
Have a
'
)
print
(
'
nice day!
'
)
#Bye bye
print
(
"
Have a
"
)
print
(
"
nice day!
"
)
# Bye bye
```
Note:
...
...
@@ -290,28 +318,27 @@ x = False
str
=
"
string
"
str2
=
str
*
2
str3
=
str2
+
"
abc
"
```
+++
```
python
print
(
a
**
3
)
print
(
b
/
2
)
print
(
d
*
2
)
print
(
x
)
print
(
str
)
print
(
str1
)
print
(
str2
)
print
(
str3
)
```
Output
```
python
8
1.6
4
+
8j
(
4
+
8j
)
False
string
stringstring
stringabc
string
stringabc
```
---
...
...
@@ -327,13 +354,14 @@ stringabc
+++
```
python
list
=
[
'
a
'
,
'
b
'
,
'
c
'
,
1
,
2
,
3
]
list
=
[
"
a
"
,
"
b
"
,
"
c
"
,
1
,
2
,
3
]
for
a
in
list
:
print
(
a
)
list
[
4
]
=
22
list
.
append
(
50
)
del
(
list
[
3
]
)
del
list
[
3
]
print
(
list
[
2
:])
```
Output:
...
...
@@ -360,7 +388,7 @@ c
+++
```
python
tuple
=
(
'
a
'
,
'
b
'
,
3
)
tuple
=
(
"
a
"
,
"
b
"
,
3
)
item
=
tuple
[
2
]
for
a
in
tuple
:
print
(
a
)
...
...
@@ -368,9 +396,10 @@ for a in tuple:
a
,
b
,
c
=
tuple
print
(
c
)
tuple2
=
(
34
,
56
,
'
d
'
)
tuple2
=
(
34
,
56
,
"
d
"
)
tuple3
=
tuple
+
tuple2
print
(
tuple3
)
```
Output:
...
...
@@ -397,13 +426,14 @@ b
+++
```
python
dict
=
{
'
Name
'
:
'
Zara
'
,
'
Age
'
:
10
,
'
Class
'
:
'
First
'
}
dict
=
{
"
Name
"
:
"
Zara
"
,
"
Age
"
:
10
,
"
Class
"
:
"
First
"
}
dict
[
'
Age
'
]
=
8
dict
[
"
Age
"
]
=
8
for
key
,
value
in
dict
.
items
():
print
(
key
,
"
:
"
,
value
)
del
dict
[
'
Name
'
]
print
(
'
Name
'
in
dict
)
del
dict
[
"
Name
"
]
print
(
"
Name
"
in
dict
)
```
Output:
...
...
@@ -434,6 +464,7 @@ set.add(2)
set
.
update
([
6
,
4
])
for
a
in
set
:
print
(
a
)
```
Output:
...
...
@@ -456,10 +487,23 @@ False
+++
```
python
def
fibonacci
(
n
):
if
n
==
0
:
return
0
elif
n
==
1
:
return
1
else
:
return
F
(
n
-
1
)
+
F
(
n
-
2
)
def
fibonacci
():
if
n
==
0
:
return
0
elif
n
==
1
:
return
1
else
:
return
fibonacci
(
n
-
1
)
+
fibonacci
(
n
-
2
)
print
(
fibonacci
(
10
))
```
Output:
```
python
55
```
+++
...
...
@@ -468,14 +512,27 @@ def fibonacci(n):
```
python
def
fibonacci
(
n
=
10
):
if
n
==
0
:
return
0
elif
n
==
1
:
return
1
else
:
return
F
(
n
-
1
)
+
F
(
n
-
2
)
if
n
==
0
:
return
0
elif
n
==
1
:
return
1
else
:
return
fibonacci
(
n
-
1
)
+
fibonacci
(
n
-
2
)
print
(
fibonacci
())
```
Output:
```
python
55
```
+++
-
Tetszőlegesen sok paraméter
-
Tetszőlegesen sok paraméter
, list
```
python
def
minimum
(
first
,
*
args
):
...
...
@@ -485,7 +542,35 @@ def minimum(first, *args):
acc
=
x
return
acc
print
(
minimum
(
3
,
4
,
2
,
-
8
,
6
))
```
Output:
```
python
-
8
```
+++
-
Tetszőlegesen sok paraméter, dictionary
```
python
def
bar
(
**
kwargs
):
for
key
,
value
in
kwargs
.
items
():
print
(
key
,
value
)
print
(
bar
(
Kutya
=
"
vau
"
,
Cica
=
"
miaaau
"
))
```
Output:
```
python
-
8
```
+++
...
...
@@ -498,30 +583,40 @@ def print_rectangle(w=0, h=0, x=0, y=0):
print
(
"
- size: {}×{}
"
.
format
(
w
,
h
))
print
(
"
- position: ({};{})
"
.
format
(
x
,
y
))
print_rectangle
(
20
,
30
,
40
,
50
)
print_rectangle
(
x
=
10
,
w
=
19
,
h
=
25
)
```
Output:
```
python
Rectangle
-
size
:
20
×
30
-
position
:
(
40
;
50
)
Rectangle
-
size
:
19
×
25
-
position
:
(
10
;
0
)
```
---
### Alap beépített fgv-ek
```
python
dir(__builtins__)
```
+++
-
input() Allowing user input
-
len() Returns the length of an object
-
abs() Returns the absolute value of a number
-
slice() Returns a slice object
-
...
-
https://www.w3schools.com/python/python_ref_functions.asp
---
...
...
@@ -539,6 +634,7 @@ i = 1
while
i
<
6
:
print
(
i
)
i
+=
1
```
Output:
...
...
@@ -566,6 +662,7 @@ print("-")
for
x
in
range
(
1
,
6
,
2
):
# for (int i = 1; i < 6; i += 2)
print
(
x
)
```
Output:
...
...
@@ -595,6 +692,7 @@ elif b or x > 5:
print
(
"
World!
"
)
else
:
print
(
"
Hello World!
"
)
```
Output:
...
...
@@ -605,6 +703,45 @@ Hello
---
### Osztályok
+++
```
python
class
A
:
b
=
"
Foo
"
def
__init__
(
self
):
self
.
a
=
1
def
print
(
self
,
str
):
for
x
in
range
(
self
.
a
):
print
(
self
.
b
,
str
)
class
B
(
A
):
def
__init__
(
self
,
a
):
self
.
a
=
a
a
=
A
()
a
.
print
(
"
Fighters
"
)
b
=
B
(
5
)
b
.
print
(
"
Ró
"
"
Fej
"
)
---
Output
```
python
Foo Fighters
Foo RóFej
Foo RóFej
Foo RóFej
Foo RóFej
Foo RóFej
```
### Dekorátor
+++
...
...
@@ -621,6 +758,7 @@ def my_decorator(func):
@my_decorator
def hello():
print("Hello")
````
Output:
...
...
@@ -630,26 +768,3 @@ Before
Hello
After
```
---
### Osztályok
+++
```python
class Employee:
'Common base class for all employees'
empCount = 0
def __init__(self, name, salary):
self.name = name
self.salary = salary
Employee.empCount += 1
def displayCount(self):
print ("Total Employee %d" % Employee.empCount)
def displayEmployee(self):
print ("Name : ", self.name, ", Salary: ", self.salary)
``
`
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment