Hey, this is an English text. I want you to translate it into the Tunisian dialect.…
- User
Hey, this is an English text. I want you to translate it into the Tunisian dialect. Please follow these steps:
- Translate step by step and highlight differences between Tunisian dialect and Modern Standard Arabic.
- Highlight sections you are confident translating into the Tunisian dialect. Translate this text into the Tunisian dialect, focusing on capturing the essence of the language nuances:
Q: Can someone tell me how to return to start of game? This is a game I coded. It is a word guessing game. from random import randint from tkinter import * def umm(): continue def quit(): master.destroy() answer = randint(0,16) wrong_answer = randint(0,16) wrong_answer1 = randint(0,16) s_list = ["apple","book","phone","sheep","ruler","pen","eraser","knife","cement","Google","file","stapler","thermometer","box","glue","yes","no"] hint_list = ["Fruit","Read","Technology","Animal","Measure Length","Writing","Stationary","Cut food", "Building Material","Search Engine","Paper organizer","Binding papers together","Temperature","Storage","Attach things together","Approval","Disapproval"] secret_word = s_list[answer] hint = f'Hint:{hint_list[answer]}' incorrect = s_list[wrong_answer] incorrect1 = s_list[wrong_answer1] master = Tk() master.title("2 Players Guessing Game!") master.geometry('700x900+90+90') def random1(): label["text"] = "Player 1 won!" def random2(): label["text"] = "Player 2 won!" def random3(): label["text"] = "Player 2 won!" def random4(): label["text"] = "Player 1 won!" label = Label(master, text="2 Player Guessing Game!", font = "Arial 14") label2 = Label(master, text="<- P1 P2 ->", font = "Arial 14") button = Button(master, text=secret_word, font = "Arial 14", command=random1) button2 = Button(master, text=incorrect, font = "Arial 14", command=random2) button3 = Button(master, text=incorrect1, font = "Arial 14", command=random2) button4 = Button(master, text=secret_word, font = "Arial 14", command=random3) button5 = Button(master, text=incorrect, font = "Arial 14", command=random4) button6 = Button(master, text=incorrect1, font = "Arial 14", command=random4) label4 = Label(master, text=hint, font = "Arial 14") button7 = Button(master, text="Again?", font = "Arial 14", command = umm) button8 = Button(master, text="Quit", font = "Arial 14", command = quit) label.pack() label2.pack() label4.pack() button.pack(side=LEFT) button2.pack(side=LEFT) button3.pack(side=LEFT) button4.pack(side=RIGHT) button5.pack(side=RIGHT) button6.pack(side=RIGHT) button7.pack() button8.pack() master.mainloop() Currently, my code shows that if Player 1 clicks the correct button on his or her side, it will print Player 1 won and vice versa. Now, I added in additional buttons, "Again?" and "Quit". I also added "continue". However, it now says continue is not properly in loop. I thought that because it is in mainloop(), this is why I can use it. But it now shows the message. Why? A: Two suggestions: You could get those word by random.choice(),it could be more easy. It is not recommended to use from tkinter import *. just like reset the whole code. In your Application,reset means:change the Player x won! to 2 Player Guessing Game!.And use random.choice() to generate a new string and show it in the button. Code: from random import choice from tkinter import * def generateRandomWord(): # at first I don't know you need to use index. secret_word.set(choice(s_list)) hint.set(final_dict[secret_word.get()]) # use dict to get the value. incorrect.set(choice(s_list)) incorrect1.set(choice(s_list)) def umm(): label['text'] = "2 Player Guessing Game!" generateRandomWord() def quit(): master.destroy() master = Tk() secret_word = StringVar() # use StringVar incorrect = StringVar() incorrect1 = StringVar() hint = StringVar() s_list = ["apple","book","phone","sheep","ruler","pen","eraser","knife","cement","Google","file","stapler","thermometer","box","glue","yes","no"] hint_list = ["Fruit","Read","Technology","Animal","Measure Length","Writing","Stationary","Cut food", "Building Material","Search Engine","Paper organizer","Binding papers together","Temperature","Storage","Attach things together","Approval","Disapproval"] final_dict = dict(zip(s_list,hint_list)) # generate a dict. generateRandomWord() master.title("2 Players Guessing Game!") master.geometry('700x900+90+90') def random1(): label["text"] = "Player 1 won!" def random2(): label["text"] = "Player 2 won!" def random3(): label["text"] = "Player 2 won!" def random4(): label["text"] = "Player 1 won!" label = Label(master, text="2 Player Guessing Game!", font = "Arial 14") label2 = Label(master, text="<- P1 P2 ->", font = "Arial 14") button =
- Assistant