+ 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.

15th Jul 2020, 7:46 AM
Vlad
6 odpowiedzi
+ 2
Please attempt your code here
15th Jul 2020, 7:48 AM
Sâñtôsh
Sâñtôsh - avatar
+ 2
Name error appears when you try to use a variable which is not defined. Maybe you did a typing mistake.
15th Jul 2020, 8:00 AM
Seb TheS
Seb TheS - avatar
+ 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_
15th Jul 2020, 8:01 AM
Vlad
+ 1
I see no import random here. Did you import random?
15th Jul 2020, 8:03 AM
Tomiwa Joseph
Tomiwa Joseph - avatar
+ 1
Yes, I imported and did two classes
15th Jul 2020, 8:27 AM
Vlad
+ 1
Vlad Tkinter? I know a little tkinter. Can you send the whole thing so I can have a proper look at it?
15th Jul 2020, 8:30 AM
Tomiwa Joseph
Tomiwa Joseph - avatar