Skip to content
Sign upLog in
← Back to Community
Business Tycoon
Profile icon
launcherman08

Hi, I'm building a game in python, and I need it to write some code at the beginning. (It has a save feature, so yeah.) And I get this error:
This file cannot be displayed: https://storage.googleapis.com/replit/images/1557508583673_b18d0fa8618a49b74ffa40bdf30c74f4.pn
Can I have some help?
Repl

Answered by HarperframeInc [earned 5 cycles]
View Answer
Voters
Profile icon
katyadee
Comments
hotnewtop
Profile icon
HarperframeInc

The Issue

On line 31 in game.py

commands_displ = colored("COMMANDS:

You are missing an end quote " and a end parenthesis )

Also, on line 1 in variable main_code:
You have a long string that has the save and load game functionality. This string is vulnerable to code errors, as Repl.it treats it like a string. Like how you made game.py, create a file called savegame.py and create functions for loading, saving, or deleting the save game.

edit: Hmmm..... It seems you were trying to create a multiline statement on line 31 in game.py. You must have forgotten to add 2 extra quotes to make it into a multiline. """This multiline statement is important for adding the extra line"""

There we go, the program is working!
This file cannot be displayed: https://storage.googleapis.com/replit/images/1557515087687_3d2f863c8146888093912aaac16c452d.pn

The Conclusion

Now that everything is working again, we need to conclude what happened so we don't make that mistake again.

First, we need to use """ instead of ". """ creates a multiline string which can output in multiple lines. We could also use \n too.

multi = """ Hello World! I am a multiline string! What about you? """ #multiline print('Look Up,\nLook Down') #give a multiline

Output:

Look Up, Look Down

Second, we shouldn't put all our code in a multiline string, as Repl can't detect code errors.

Third, we need to organize code into functions and classes which will help us understand the code. It's also nice to document it with #comments and """multilines""".

def load(): #loads savegame """ This load function loads savegame. Very Important Piece of the Game. Some errors on line 10 """ #loading print('Loaded!') #show msg when complete q = 1/0 #hmmm..... this seems to return an error.

Did it help? Mark this as the correct answer

Profile icon
launcherman08

@HarperframeInc
Thank you! This was a really big help!

Profile icon
HarperframeInc

@launcherman08
You already have a define statement in your multiline strings. You could put this into use by making a load.py and save.py file. Replit will be able to detect errors.

Profile icon
JesseHintz

Business Tycoon is a business simulation game in which you have to manage a company. You will have to make decisions about hiring new employees, buying new equipment and so on. It's not easy though! You will have to make difficult choices and if you don't make them well, then the whole business could collapse. Now I have to view the examples of business proposals email templates before applying for any job.

Profile icon
KatzenMachen

I am currently reading The Polyster Prince and one really cannot ignore the fact that he has been the most successful businessman in India. Although he was responsible for corruption and a lot of other unlawful things, if not illegal, he surely did know how to get people on his side. The media, the government, and most importantly the people of our country. When you do wrong, the media might support you but in the end, people know what's happening around you. For Example, I won't name any of the current Ministers, but you can guess at least one of them, since I’m from Maharashtra, you know whom I’m talking bout. This guy has the media on his side. And people still know he’s corrupt and a lot of them are against him. But if I compare this with Dhirubhai, people have supported most of the decisions. Whether you are generous to the public or you literally buy all the media, it still cannot get the public on your side. But with Dhirubhai, he’s considered not just The Businessman in India, but around the globe.

Since you’ve mentioned Business Tycoons, there are many of them like Mariwala, Champaklal Choksey, Dhingra Brothers, and others who have done a lot of interesting, useful and contributed to the development of the business. I have been doing this for a year now using the site https://vipresponse.nl and I can say that most of the principles that are described there are used in this area and were used by our predecessors.