I wrote this code:
class Player:
def __init__(self, nick, positon, kills, deaths, jogos):
print( "Computando jogador ... {}".format( self ) )
self.__nick = nick
self.__positon = positon
self.__kills = kills
self.__deaths = deaths
self.__jogos = jogos
self.__KDR = (self.__kills / self.__deaths)
def player_info(self):
kdr = (self.__kills / self.__deaths)
print( "Jogador: {} \nPosição: {} \nFicou com o KD de {}/{}, em um total de {} jogos".format( self.__nick,
self.__positon,
self.__kills,
self.__deaths,
self.__jogos ),
'\n'
"KDR: {:1.2f}".format( kdr ) )
def add_games(self, valor):
self.__jogos += valor
def add_kills(self, valor):
self.__kills += valor
def add_deaths(self, valor):
self.__deaths += valor
def add_kd(self, valor1, valor2, valor3):
self.__kills += valor1
self.__deaths += valor2
self.__jogos += valor3
def take_kills(self, valor):
self.__kills -= valor
def take_deaths(self, valor):
self.__deaths -= valor
def take_games(self, valor):
self.__jogos -= valor
def save(self):
kdr = (self.__kills / self.__deaths)
kdr = round( kdr, 2 )
str(kdr)
print( str( kdr ) )
fd = open( 'KDR.txt', "w" )
fd.write( "Jogador: {} \nPosição: {} \nFicou com o KD de {}/{}, em um total de {} jogos".format(self.__nick, self.__positon, self.__kills, self.__deaths, self.__jogos)
+'\n' "KDR: " + str(kdr))
I want to make an executable that can stores the self.player_info() output in a textfile called KDA.txt But I don't know any way that I could run the code as a console but using a .exe archive. Sorry if something here was wrong, I'm a 15 years old Brazilian, so if something is wrong and you want to help me i would be glad