0
newbie problems
problems with line 10 from tkinter import * from random import * # variables first_number = 0 second_number = 0 sign = {0 :"+",1 :"-",2 :"/",3 :"*" } answer = 0 character_number = 1 text_given =first_number+sign[1]+second_number #creating a window root =Tk() root.title("ratme") root.minsize(600, 600) root.maxsize(2080, 2160) #body given = Label(text = text_given ,font = "{Courier new} 14 bold") given.place( relx = 0.1, rely = 0.1, relwidth = 0.3, relheigh = 0.5 ) root.mainloop()
2 Answers
+ 1
Try this :
text_given =f"{first_number}{sign[1]}{second_number}"
If you want to evaluate use eval() function on
result = eval(text_given)