A little Python life simulation gamePython - Game Of LifeMafia game simulation engineFootball game simulationGame of life in kivy pythonGame of Life simulation using Python and TkinterRock Climbing Simulation GameA little stock market game in PythonA little “explore” type of game in PythonConway's Game of Life implemented in PythonGame of Life simulator, Python 3

Is there an wasy way to program in Tikz something like the one in the image?

Why isn't KTEX's runway designation 10/28 instead of 9/27?

What is the opposite of 'gravitas'?

Music terminology - why are seven letters used to name scale tones

Calculating the number of days between 2 dates in Excel

Can a Bard use an arcane focus?

I2C signal and power over long range (10meter cable)

Stereotypical names

Simple image editor tool to draw a simple box/rectangle in an existing image

Did US corporations pay demonstrators in the German demonstrations against article 13?

Identify a stage play about a VR experience in which participants are encouraged to simulate performing horrific activities

Meta programming: Declare a new struct on the fly

Resetting two CD4017 counters simultaneously, only one resets

Can the electrostatic force be infinite in magnitude?

Is there a problem with hiding "forgot password" until it's needed?

Can a Gentile theist be saved?

Giant Toughroad SLR 2 for 200 miles in two days, will it make it?

Indicating multiple different modes of speech (fantasy language or telepathy)

I'm in charge of equipment buying but no one's ever happy with what I choose. How to fix this?

Is it okay / does it make sense for another player to join a running game of Munchkin?

Can I use my Chinese passport to enter China after I acquired another citizenship?

For airliners, what prevents wing strikes on landing in bad weather?

In Star Trek IV, why did the Bounty go back to a time when whales were already rare?

Why are on-board computers allowed to change controls without notifying the pilots?



A little Python life simulation game


Python - Game Of LifeMafia game simulation engineFootball game simulationGame of life in kivy pythonGame of Life simulation using Python and TkinterRock Climbing Simulation GameA little stock market game in PythonA little “explore” type of game in PythonConway's Game of Life implemented in PythonGame of Life simulator, Python 3













0












$begingroup$


This is one of many little python text based games that I have to share here!



This one is a life sim game, try to get as far as possible without reaching 0 thirst, you can replenish, of course. Try to get as many degrees as possible, and start making big bucks!



If you have any questions or feedback, please let me know!



import time
import sys
import random
#####
class Player:

def __init__(self, name):
self.name = name
self.money = 0
###############################
self.health = 100
self.water = 100
self.food = 100
###############################
pass


p = Player("Player")




class emblem:

def __init__(self,name):
self.name = name
self.emblem = 0
pass

begemb = emblem("Begger Emblem")
apart = emblem("Apartment Key")
college = emblem("College emb")

admin = emblem("Admin Emblem")

class Job:

def __init__(self, name, requirements, pay):
self.name = name
self.requirements = requirements
self.pay = pay
pass
beg = Job("Begging", 0, 10)
jojo = Job("Fast Food", 0, 100) #requires apartment emblem


class foo:

def __init__(self, name, price, fill):
self.name = name
self.price = price
self.fill = fill
pass
dai = foo("Daily Set of Essentials", 30, 100) ##decrease of 10 per day for


#upkeep



def stats():
p.water -= 10
p.food -= 10
print("Food:")
print p.food
print("Water:")
print p.water
if p.water == 0:
print("Game Over")
sys.exit()
else:
print("Money:")
print p.money
cycle()

def cycle():
if apart.emblem == 1:
print("1.) Store")
print("2.) To The Day")
print("3.) School")
cyclea = input("")
if cyclea == 1:
store()
elif cyclea == 2:
job()
elif cyclea == 3:
school()
else:
print("1.) Store")
print("2.) To The Day")
cycle = input("")
if cycle == 1:
store()
if cycle == 2:
job()

def stores():
store()

def store():
print("1.) +100 Health, 100 Water, 100 Food. (30$)")
print("2.) Apartment Key (300$)")
print("3.) Back")
store = input("")
if store == 1:
p.money -= 30
p.health += 100
p.water += 100
p.food += 100
print("+100 Health")
print("+100 Water")
print("+100 Food")
stores()
elif store == 2:
apart.emblem += 1
stores()
elif store == 3:
cycle()
elif store == 887324:
admin.emblem += 1
stores()

def job():
if college.emblem == 1:
print("You are eligible for:")
print("1.) Begging / Pay: 10")
print("2.) Working in fast food restuarant / Pay: 100")
print("3.) Working in office / Pay: 1000")
print("4.) Working in institution / Pay: 3500")
cme = input("")
if cme == 1:
p.money += 10
stats()
elif cme == 2:
p.money += 100
stats()
elif cme == 3:
p.money += 1000
stats()
elif cme == 4:
p.money += 3500
stats()


elif high.emblem == 1:
print("You are eligible for:")
print("1.) Begging / Pay: 10")
print("2.) Working in fast food restuarant / Pay: 100")
print("3.) Working in office / Pay: 1000")
highme = input("")
if highme == 1:
p.money += 10
stats()
elif highme == 2:
p.money += 100
stats()
elif highme == 3:
p.money += 1000
stats()



elif apart.emblem == 1:
print("You are eligible for:")
print ("1.) Begging / Pay: 10")
print("2.) Working In Fast Food Restuarant / Pay: 100")
job = input("")
if job == 1:
p.money += 10
stats()
if job == 2:
p.money += 100
stats()
else:
print("You are eligible for:")
print("1.) Begging / Pay: 10")
job1 = input("")
if job1 == 1:
p.money += 10
stats()
high = emblem("High School Graduate")

def schools():
school()

def school():
if high.emblem == 1:
print("1.) College / 5000")
print("2.) Back")
papi = input("")
if papi == 1:
college.emblem += 1
schools()
elif papi == 2:
cycle()



elif admin.emblem == 1:
print("1.) Admin School / FREE")
adme = input("")
if adme == 1:
high.emblem += 1
cycle()
else:
print("1.) High School / 1000")
print("2.) Back")
schoolme = input("")
if schoolme == 1:
p.money -= 1000
high.emblem += 1
schools()
elif schoolme == 2:
cycle()


def day():
print("")














stats()









share|improve this question











$endgroup$







  • 4




    $begingroup$
    You have posted four questions recently, all of which are actually quite similar to each other in style, and have similar issues. Please wait for feedback on existing questions before posting more questions.
    $endgroup$
    – 200_success
    Mar 30 '18 at 21:14
















0












$begingroup$


This is one of many little python text based games that I have to share here!



This one is a life sim game, try to get as far as possible without reaching 0 thirst, you can replenish, of course. Try to get as many degrees as possible, and start making big bucks!



If you have any questions or feedback, please let me know!



import time
import sys
import random
#####
class Player:

def __init__(self, name):
self.name = name
self.money = 0
###############################
self.health = 100
self.water = 100
self.food = 100
###############################
pass


p = Player("Player")




class emblem:

def __init__(self,name):
self.name = name
self.emblem = 0
pass

begemb = emblem("Begger Emblem")
apart = emblem("Apartment Key")
college = emblem("College emb")

admin = emblem("Admin Emblem")

class Job:

def __init__(self, name, requirements, pay):
self.name = name
self.requirements = requirements
self.pay = pay
pass
beg = Job("Begging", 0, 10)
jojo = Job("Fast Food", 0, 100) #requires apartment emblem


class foo:

def __init__(self, name, price, fill):
self.name = name
self.price = price
self.fill = fill
pass
dai = foo("Daily Set of Essentials", 30, 100) ##decrease of 10 per day for


#upkeep



def stats():
p.water -= 10
p.food -= 10
print("Food:")
print p.food
print("Water:")
print p.water
if p.water == 0:
print("Game Over")
sys.exit()
else:
print("Money:")
print p.money
cycle()

def cycle():
if apart.emblem == 1:
print("1.) Store")
print("2.) To The Day")
print("3.) School")
cyclea = input("")
if cyclea == 1:
store()
elif cyclea == 2:
job()
elif cyclea == 3:
school()
else:
print("1.) Store")
print("2.) To The Day")
cycle = input("")
if cycle == 1:
store()
if cycle == 2:
job()

def stores():
store()

def store():
print("1.) +100 Health, 100 Water, 100 Food. (30$)")
print("2.) Apartment Key (300$)")
print("3.) Back")
store = input("")
if store == 1:
p.money -= 30
p.health += 100
p.water += 100
p.food += 100
print("+100 Health")
print("+100 Water")
print("+100 Food")
stores()
elif store == 2:
apart.emblem += 1
stores()
elif store == 3:
cycle()
elif store == 887324:
admin.emblem += 1
stores()

def job():
if college.emblem == 1:
print("You are eligible for:")
print("1.) Begging / Pay: 10")
print("2.) Working in fast food restuarant / Pay: 100")
print("3.) Working in office / Pay: 1000")
print("4.) Working in institution / Pay: 3500")
cme = input("")
if cme == 1:
p.money += 10
stats()
elif cme == 2:
p.money += 100
stats()
elif cme == 3:
p.money += 1000
stats()
elif cme == 4:
p.money += 3500
stats()


elif high.emblem == 1:
print("You are eligible for:")
print("1.) Begging / Pay: 10")
print("2.) Working in fast food restuarant / Pay: 100")
print("3.) Working in office / Pay: 1000")
highme = input("")
if highme == 1:
p.money += 10
stats()
elif highme == 2:
p.money += 100
stats()
elif highme == 3:
p.money += 1000
stats()



elif apart.emblem == 1:
print("You are eligible for:")
print ("1.) Begging / Pay: 10")
print("2.) Working In Fast Food Restuarant / Pay: 100")
job = input("")
if job == 1:
p.money += 10
stats()
if job == 2:
p.money += 100
stats()
else:
print("You are eligible for:")
print("1.) Begging / Pay: 10")
job1 = input("")
if job1 == 1:
p.money += 10
stats()
high = emblem("High School Graduate")

def schools():
school()

def school():
if high.emblem == 1:
print("1.) College / 5000")
print("2.) Back")
papi = input("")
if papi == 1:
college.emblem += 1
schools()
elif papi == 2:
cycle()



elif admin.emblem == 1:
print("1.) Admin School / FREE")
adme = input("")
if adme == 1:
high.emblem += 1
cycle()
else:
print("1.) High School / 1000")
print("2.) Back")
schoolme = input("")
if schoolme == 1:
p.money -= 1000
high.emblem += 1
schools()
elif schoolme == 2:
cycle()


def day():
print("")














stats()









share|improve this question











$endgroup$







  • 4




    $begingroup$
    You have posted four questions recently, all of which are actually quite similar to each other in style, and have similar issues. Please wait for feedback on existing questions before posting more questions.
    $endgroup$
    – 200_success
    Mar 30 '18 at 21:14














0












0








0


0



$begingroup$


This is one of many little python text based games that I have to share here!



This one is a life sim game, try to get as far as possible without reaching 0 thirst, you can replenish, of course. Try to get as many degrees as possible, and start making big bucks!



If you have any questions or feedback, please let me know!



import time
import sys
import random
#####
class Player:

def __init__(self, name):
self.name = name
self.money = 0
###############################
self.health = 100
self.water = 100
self.food = 100
###############################
pass


p = Player("Player")




class emblem:

def __init__(self,name):
self.name = name
self.emblem = 0
pass

begemb = emblem("Begger Emblem")
apart = emblem("Apartment Key")
college = emblem("College emb")

admin = emblem("Admin Emblem")

class Job:

def __init__(self, name, requirements, pay):
self.name = name
self.requirements = requirements
self.pay = pay
pass
beg = Job("Begging", 0, 10)
jojo = Job("Fast Food", 0, 100) #requires apartment emblem


class foo:

def __init__(self, name, price, fill):
self.name = name
self.price = price
self.fill = fill
pass
dai = foo("Daily Set of Essentials", 30, 100) ##decrease of 10 per day for


#upkeep



def stats():
p.water -= 10
p.food -= 10
print("Food:")
print p.food
print("Water:")
print p.water
if p.water == 0:
print("Game Over")
sys.exit()
else:
print("Money:")
print p.money
cycle()

def cycle():
if apart.emblem == 1:
print("1.) Store")
print("2.) To The Day")
print("3.) School")
cyclea = input("")
if cyclea == 1:
store()
elif cyclea == 2:
job()
elif cyclea == 3:
school()
else:
print("1.) Store")
print("2.) To The Day")
cycle = input("")
if cycle == 1:
store()
if cycle == 2:
job()

def stores():
store()

def store():
print("1.) +100 Health, 100 Water, 100 Food. (30$)")
print("2.) Apartment Key (300$)")
print("3.) Back")
store = input("")
if store == 1:
p.money -= 30
p.health += 100
p.water += 100
p.food += 100
print("+100 Health")
print("+100 Water")
print("+100 Food")
stores()
elif store == 2:
apart.emblem += 1
stores()
elif store == 3:
cycle()
elif store == 887324:
admin.emblem += 1
stores()

def job():
if college.emblem == 1:
print("You are eligible for:")
print("1.) Begging / Pay: 10")
print("2.) Working in fast food restuarant / Pay: 100")
print("3.) Working in office / Pay: 1000")
print("4.) Working in institution / Pay: 3500")
cme = input("")
if cme == 1:
p.money += 10
stats()
elif cme == 2:
p.money += 100
stats()
elif cme == 3:
p.money += 1000
stats()
elif cme == 4:
p.money += 3500
stats()


elif high.emblem == 1:
print("You are eligible for:")
print("1.) Begging / Pay: 10")
print("2.) Working in fast food restuarant / Pay: 100")
print("3.) Working in office / Pay: 1000")
highme = input("")
if highme == 1:
p.money += 10
stats()
elif highme == 2:
p.money += 100
stats()
elif highme == 3:
p.money += 1000
stats()



elif apart.emblem == 1:
print("You are eligible for:")
print ("1.) Begging / Pay: 10")
print("2.) Working In Fast Food Restuarant / Pay: 100")
job = input("")
if job == 1:
p.money += 10
stats()
if job == 2:
p.money += 100
stats()
else:
print("You are eligible for:")
print("1.) Begging / Pay: 10")
job1 = input("")
if job1 == 1:
p.money += 10
stats()
high = emblem("High School Graduate")

def schools():
school()

def school():
if high.emblem == 1:
print("1.) College / 5000")
print("2.) Back")
papi = input("")
if papi == 1:
college.emblem += 1
schools()
elif papi == 2:
cycle()



elif admin.emblem == 1:
print("1.) Admin School / FREE")
adme = input("")
if adme == 1:
high.emblem += 1
cycle()
else:
print("1.) High School / 1000")
print("2.) Back")
schoolme = input("")
if schoolme == 1:
p.money -= 1000
high.emblem += 1
schools()
elif schoolme == 2:
cycle()


def day():
print("")














stats()









share|improve this question











$endgroup$




This is one of many little python text based games that I have to share here!



This one is a life sim game, try to get as far as possible without reaching 0 thirst, you can replenish, of course. Try to get as many degrees as possible, and start making big bucks!



If you have any questions or feedback, please let me know!



import time
import sys
import random
#####
class Player:

def __init__(self, name):
self.name = name
self.money = 0
###############################
self.health = 100
self.water = 100
self.food = 100
###############################
pass


p = Player("Player")




class emblem:

def __init__(self,name):
self.name = name
self.emblem = 0
pass

begemb = emblem("Begger Emblem")
apart = emblem("Apartment Key")
college = emblem("College emb")

admin = emblem("Admin Emblem")

class Job:

def __init__(self, name, requirements, pay):
self.name = name
self.requirements = requirements
self.pay = pay
pass
beg = Job("Begging", 0, 10)
jojo = Job("Fast Food", 0, 100) #requires apartment emblem


class foo:

def __init__(self, name, price, fill):
self.name = name
self.price = price
self.fill = fill
pass
dai = foo("Daily Set of Essentials", 30, 100) ##decrease of 10 per day for


#upkeep



def stats():
p.water -= 10
p.food -= 10
print("Food:")
print p.food
print("Water:")
print p.water
if p.water == 0:
print("Game Over")
sys.exit()
else:
print("Money:")
print p.money
cycle()

def cycle():
if apart.emblem == 1:
print("1.) Store")
print("2.) To The Day")
print("3.) School")
cyclea = input("")
if cyclea == 1:
store()
elif cyclea == 2:
job()
elif cyclea == 3:
school()
else:
print("1.) Store")
print("2.) To The Day")
cycle = input("")
if cycle == 1:
store()
if cycle == 2:
job()

def stores():
store()

def store():
print("1.) +100 Health, 100 Water, 100 Food. (30$)")
print("2.) Apartment Key (300$)")
print("3.) Back")
store = input("")
if store == 1:
p.money -= 30
p.health += 100
p.water += 100
p.food += 100
print("+100 Health")
print("+100 Water")
print("+100 Food")
stores()
elif store == 2:
apart.emblem += 1
stores()
elif store == 3:
cycle()
elif store == 887324:
admin.emblem += 1
stores()

def job():
if college.emblem == 1:
print("You are eligible for:")
print("1.) Begging / Pay: 10")
print("2.) Working in fast food restuarant / Pay: 100")
print("3.) Working in office / Pay: 1000")
print("4.) Working in institution / Pay: 3500")
cme = input("")
if cme == 1:
p.money += 10
stats()
elif cme == 2:
p.money += 100
stats()
elif cme == 3:
p.money += 1000
stats()
elif cme == 4:
p.money += 3500
stats()


elif high.emblem == 1:
print("You are eligible for:")
print("1.) Begging / Pay: 10")
print("2.) Working in fast food restuarant / Pay: 100")
print("3.) Working in office / Pay: 1000")
highme = input("")
if highme == 1:
p.money += 10
stats()
elif highme == 2:
p.money += 100
stats()
elif highme == 3:
p.money += 1000
stats()



elif apart.emblem == 1:
print("You are eligible for:")
print ("1.) Begging / Pay: 10")
print("2.) Working In Fast Food Restuarant / Pay: 100")
job = input("")
if job == 1:
p.money += 10
stats()
if job == 2:
p.money += 100
stats()
else:
print("You are eligible for:")
print("1.) Begging / Pay: 10")
job1 = input("")
if job1 == 1:
p.money += 10
stats()
high = emblem("High School Graduate")

def schools():
school()

def school():
if high.emblem == 1:
print("1.) College / 5000")
print("2.) Back")
papi = input("")
if papi == 1:
college.emblem += 1
schools()
elif papi == 2:
cycle()



elif admin.emblem == 1:
print("1.) Admin School / FREE")
adme = input("")
if adme == 1:
high.emblem += 1
cycle()
else:
print("1.) High School / 1000")
print("2.) Back")
schoolme = input("")
if schoolme == 1:
p.money -= 1000
high.emblem += 1
schools()
elif schoolme == 2:
cycle()


def day():
print("")














stats()






python python-3.x game






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 31 '18 at 14:26







Colea

















asked Mar 30 '18 at 19:58









ColeaColea

214112




214112







  • 4




    $begingroup$
    You have posted four questions recently, all of which are actually quite similar to each other in style, and have similar issues. Please wait for feedback on existing questions before posting more questions.
    $endgroup$
    – 200_success
    Mar 30 '18 at 21:14













  • 4




    $begingroup$
    You have posted four questions recently, all of which are actually quite similar to each other in style, and have similar issues. Please wait for feedback on existing questions before posting more questions.
    $endgroup$
    – 200_success
    Mar 30 '18 at 21:14








4




4




$begingroup$
You have posted four questions recently, all of which are actually quite similar to each other in style, and have similar issues. Please wait for feedback on existing questions before posting more questions.
$endgroup$
– 200_success
Mar 30 '18 at 21:14





$begingroup$
You have posted four questions recently, all of which are actually quite similar to each other in style, and have similar issues. Please wait for feedback on existing questions before posting more questions.
$endgroup$
– 200_success
Mar 30 '18 at 21:14











1 Answer
1






active

oldest

votes


















0












$begingroup$

I am running this on Python 3.7.2, but I think my answer will work.



on line 65, or



print p.food


You are missing parentheses around p.food. So you should change it to this:



print(p.food)


This also happens on line 67 and 73.



When you use input, the input function returns a string. However, in your code, you do not use quotes around your results, like this:



print("1.) +100 Health, 100 Water, 100 Food. (30$)")
print("2.) Apartment Key (300$)")
print("3.) Back")
store = input("")
if store == 1:
p.money -= 30
p.health += 100
p.water += 100
p.food += 100
print("+100 Health")
print("+100 Water")
print("+100 Food")
stores()
elif store == 2:
apart.emblem += 1
stores()
elif store == 3:
cycle()
elif store == 887324:
admin.emblem += 1
stores()


On the if- statements in your code, you use integers rather than strings. Add quotes around them, or change the input to intgers. Like this:



if store == 1:


or



store = int(input(""))




share









$endgroup$












    Your Answer





    StackExchange.ifUsing("editor", function ()
    return StackExchange.using("mathjaxEditing", function ()
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
    );
    );
    , "mathjax-editing");

    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "196"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f190889%2fa-little-python-life-simulation-game%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0












    $begingroup$

    I am running this on Python 3.7.2, but I think my answer will work.



    on line 65, or



    print p.food


    You are missing parentheses around p.food. So you should change it to this:



    print(p.food)


    This also happens on line 67 and 73.



    When you use input, the input function returns a string. However, in your code, you do not use quotes around your results, like this:



    print("1.) +100 Health, 100 Water, 100 Food. (30$)")
    print("2.) Apartment Key (300$)")
    print("3.) Back")
    store = input("")
    if store == 1:
    p.money -= 30
    p.health += 100
    p.water += 100
    p.food += 100
    print("+100 Health")
    print("+100 Water")
    print("+100 Food")
    stores()
    elif store == 2:
    apart.emblem += 1
    stores()
    elif store == 3:
    cycle()
    elif store == 887324:
    admin.emblem += 1
    stores()


    On the if- statements in your code, you use integers rather than strings. Add quotes around them, or change the input to intgers. Like this:



    if store == 1:


    or



    store = int(input(""))




    share









    $endgroup$

















      0












      $begingroup$

      I am running this on Python 3.7.2, but I think my answer will work.



      on line 65, or



      print p.food


      You are missing parentheses around p.food. So you should change it to this:



      print(p.food)


      This also happens on line 67 and 73.



      When you use input, the input function returns a string. However, in your code, you do not use quotes around your results, like this:



      print("1.) +100 Health, 100 Water, 100 Food. (30$)")
      print("2.) Apartment Key (300$)")
      print("3.) Back")
      store = input("")
      if store == 1:
      p.money -= 30
      p.health += 100
      p.water += 100
      p.food += 100
      print("+100 Health")
      print("+100 Water")
      print("+100 Food")
      stores()
      elif store == 2:
      apart.emblem += 1
      stores()
      elif store == 3:
      cycle()
      elif store == 887324:
      admin.emblem += 1
      stores()


      On the if- statements in your code, you use integers rather than strings. Add quotes around them, or change the input to intgers. Like this:



      if store == 1:


      or



      store = int(input(""))




      share









      $endgroup$















        0












        0








        0





        $begingroup$

        I am running this on Python 3.7.2, but I think my answer will work.



        on line 65, or



        print p.food


        You are missing parentheses around p.food. So you should change it to this:



        print(p.food)


        This also happens on line 67 and 73.



        When you use input, the input function returns a string. However, in your code, you do not use quotes around your results, like this:



        print("1.) +100 Health, 100 Water, 100 Food. (30$)")
        print("2.) Apartment Key (300$)")
        print("3.) Back")
        store = input("")
        if store == 1:
        p.money -= 30
        p.health += 100
        p.water += 100
        p.food += 100
        print("+100 Health")
        print("+100 Water")
        print("+100 Food")
        stores()
        elif store == 2:
        apart.emblem += 1
        stores()
        elif store == 3:
        cycle()
        elif store == 887324:
        admin.emblem += 1
        stores()


        On the if- statements in your code, you use integers rather than strings. Add quotes around them, or change the input to intgers. Like this:



        if store == 1:


        or



        store = int(input(""))




        share









        $endgroup$



        I am running this on Python 3.7.2, but I think my answer will work.



        on line 65, or



        print p.food


        You are missing parentheses around p.food. So you should change it to this:



        print(p.food)


        This also happens on line 67 and 73.



        When you use input, the input function returns a string. However, in your code, you do not use quotes around your results, like this:



        print("1.) +100 Health, 100 Water, 100 Food. (30$)")
        print("2.) Apartment Key (300$)")
        print("3.) Back")
        store = input("")
        if store == 1:
        p.money -= 30
        p.health += 100
        p.water += 100
        p.food += 100
        print("+100 Health")
        print("+100 Water")
        print("+100 Food")
        stores()
        elif store == 2:
        apart.emblem += 1
        stores()
        elif store == 3:
        cycle()
        elif store == 887324:
        admin.emblem += 1
        stores()


        On the if- statements in your code, you use integers rather than strings. Add quotes around them, or change the input to intgers. Like this:



        if store == 1:


        or



        store = int(input(""))





        share











        share


        share










        answered 2 mins ago









        Jerry CuiJerry Cui

        264




        264



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Code Review Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f190889%2fa-little-python-life-simulation-game%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            瀋陽號驅逐艦 目录 接收與服役 配置反潛直升機 武進三型性能升級 歷史 除役 參考資料 外部連結 导航菜单Taiwan Air Power海疆老兵-陽字號驅逐艦沿革World Navies Today: Taiwan (Republic of China)DD-839 USS POWER

            Memorizing the KeyboardThe Norwegian Foreman''If the B…''The Consonant EaterThe Cherry TreeElle Rend Le Coeur Plus AmoureuxFill in the blanks with the number in wordsState of the UnionFind the missing elementsCircuit DiagramWhat's the name of the game show?

            名間水力發電廠 目录 沿革 設施 鄰近設施 註釋 外部連結 导航菜单23°50′10″N 120°42′41″E / 23.83611°N 120.71139°E / 23.83611; 120.7113923°50′10″N 120°42′41″E / 23.83611°N 120.71139°E / 23.83611; 120.71139計畫概要原始内容臺灣第一座BOT 模式開發的水力發電廠-名間水力電廠名間水力發電廠 水利署首件BOT案原始内容《小檔案》名間電廠 首座BOT水力發電廠原始内容名間電廠BOT - 經濟部水利署中區水資源局