+ 1
I can't write code because there's print(...) in func. And I need to print it. When I get print out of func it takes Nameeror.
6 ответов
+ 2
Please attempt your code here
+ 2
Name error appears when you try to use a variable which is not defined.
Maybe you did a typing mistake.
+ 1
def func2():
a = list()
companies = ["S7", "British Airlines", "Урал", "Аэрофлот"]
p = list()
for i in range(0, 50):
random_company = random.choice(companies)
random_v = random.randint(0, 5000)
random_b = random.randint(0, 5000)
airplns = Airplane(random_company, random_v, random_b)
a.append(airplns)
return (a)
return (random_b)
return (random_v)
return (random_company)
for i in range(0,50):
polet_v = random.randint(0,5000)
polet_b = random.randint(0,5000)
polet = Polet(polet_v, polet_b)
p.append(polet)
for i in range(0, 50):
tk = Tk()
canvas = Canvas(tk, width=5000, height=5000)
canvas.pack()
canvas.create_line(polet_b, polet_v, random_v, random_b)
S = random.randint(1,10)
time.sleep(S)
return (polet_b)
return (polet_v)
print("Самолёт компании ", (random_company), ", который в координатах", (random_
+ 1
I see no import random here.
Did you import random?
+ 1
Yes, I imported and did two classes
+ 1
Vlad Tkinter? I know a little tkinter. Can you send the whole thing so I can have a proper look at it?