Q:

python I get a nameerror ? I already have a variable named that

# -*- coding:utf-8 -*-
# ötszaz.py
# , 2017

érték = {"1":500,
         "2":450,
         "3":400}

# --- 1.feladat ---

with open("penztar.txt","r") as ff:
          adatok = ff.read()

# --- 2. feladat ---
print("2.feladat\nA fizetések száma: {}".format(adatok.count("F")))

# --- 3.feladat ---
kosar = []
sok_kosar = []
for dolog in adatok.splitlines():    
    if dolog != "F":
        kosar.append(dolog)
    elif dolog == "F":
        sok_kosar.append(kosar)
        del kosar

##kosarak = elso(adatok.splitlines())
for i in sok_kosar: print(i)

I get this error :
Traceback (most recent call last):
  File "C:\Users\Zsolt\Desktop\python ératségi\ötszáz\otszaz.py", line 23, in 
    kosar.append(dolog)
NameError: name 'kosar' is not defined

A:

for dolog in adatok.splitlines():    
    if dolog != "F":
        kosar.append(dolog)
    elif dolog == "F":
        sok_kosar.append(kosar)
        del kosar

What are you expecting to happen in the iteration after the iteration in which dolog == "F"? If dolog == "F" You delete kosar. In the next iteration, kosar is undefined.
Your code is essentially equivalent to:
>>> li = []
>>> nums = [1, 2, 3]
>>> for num in nums:
...     print(num)
...     if num == 2:
...         del li
...     else:
...         li.append(num)
...
1
2
3
Traceback (most recent call last):
  File "<stdin>", line 6, in <module>
NameError: name 'li' is not defined

If you meant to empty the list, instead of del kosar use kosar = [].

