Python Forum
'answers 2' is not defined on line 27
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'answers 2' is not defined on line 27
#5
(Sep-02-2023, 10:50 PM)deanhystad Wrote: Yes, pass is a placeholder for a block of code. That is what it is doing here:
  if adopt == "1":
    pass
Once you enter the block of code you remove the placeholder. Why is pass still here?
  if adopt == "2": 
    print("Oh well! You go home with no cat")
    pass
    if adopt == "3":
      answers3 = ['You receive money and go home happily!', 'The workers laugh at you and have you escorted out of the propery, start again for another ending!','The workers laugh at you and have you escorted out of the propery, start again for another ending!', 'The workers laugh at you and have you escorted out of the propery, start again for another ending!']
      import random
      print(random.choice(answers3))
      #Take home route
Since pass does nothing except act as a stand-in there is no harm leaving it there, but others looking at your code will think "That's odd." and look for meaning.

I drew out the graph to the best of my understanding. It is far more complicated than you think. Currently it is incomplete, but it looks like you should be able to return to the shelter and adopt the cat again forever and ever.

You are trying to solve this problem in the hardest way possible.

Thank you. This helps a lot.
Reply


Messages In This Thread
'answers 2' is not defined on line 27 - by 0814uu - Sep-02-2023, 09:58 PM
RE: 'answers 2' is not defined on line 27 - by 0814uu - Sep-02-2023, 11:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Division calcuation with answers to 1decimal place. sik 3 2,220 Jul-15-2021, 08:15 AM
Last Post: DeaD_EyE
  Cannot Assign right Answers To Shuffled Questions Boblows 6 2,868 Jan-22-2021, 09:41 AM
Last Post: buran
  python library not defined in user defined function johnEmScott 2 3,975 May-30-2020, 04:14 AM
Last Post: DT2000
  Using answers from an input function Totalartist 3 2,291 Jul-19-2019, 02:02 PM
Last Post: snippsat
  classes , error at line 88 name finnKategori not defined sydlender 3 3,034 Nov-12-2018, 09:08 PM
Last Post: buran
  Writing Answers From Questionnaire to a new .txt Document FizzyBreak579 4 3,691 Feb-16-2018, 07:26 AM
Last Post: buran
  Need Answers 20nick20 6 5,539 Apr-29-2017, 04:06 PM
Last Post: Larz60+
  Code that generates MD5 hashes from IPv6 addresses giving differant answers? PyMD5 4 6,579 Oct-17-2016, 02:39 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020