import pythongame from pythongame.locals import* pythongame.int(); int number of
ID: 3742684 • Letter: I
Question
import pythongame
from pythongame.locals import*
pythongame.int();
int number of players;
screen=pythongame.visible_players((number, //to show the name of players
player name = pythongame.name("master mind players")
visual.display(0) //clear the screen before naming
visual.name(player, (master mind))
pythongame.display.visual()
//generates hidden code
for app in pythongame.application.get():
if event.type==pythongame.QUIT://check whether displays
pythongame.quit() //if it hides
exit(0)
Anyone have any idea why is there a syntax error in the one in bold and italics?
Explanation / Answer
Error:
invalid syntax
Reason:
There is no way to decalre types in python for a variable. You can create variable when you need it in the code as below.
number_of_players=0;
So simply remove int from your code. It will not throw the same error.
Or use init in pytho to declare variables
Or create that variable when it is needed.
I hope it helps you.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.