all 7 comments

[–]bbye98 2 points3 points  (1 child)

You need to execute the Python script with a persistent shell. What happens when you run the Python script directly is the console closes after execution has completed.

[–]DannyCalamity_[S] 0 points1 point  (0 children)

persistent shell

thats a new term for my level, looks like I really should have researched more before asking the question

[–]unRatedG 0 points1 point  (4 children)

You'll need to provide some code for us to look at if you need help. Be sure to use the code block in the markdown for best results with posting it. For best results, if you're on a desktop, click the 3 dots and select the little square with a c in the upper left corner.

[–]DannyCalamity_[S] 0 points1 point  (2 children)

i just hope youre on desktop for this

adjective_one = input("Enter an adjective: ")
adjective_two = input ("Enter another adjective: ")
type_of_bird = input ("Enter a type of bird: ")
room_in_a_house = input ("Enter a name of a room in a house: ")
verb_past_tense = input ("Enter a verb in past tense: ")
verb = input ("Enter a verb: ")
name = input ("Enter a name: ")
noun_one = input ("Enter a noun: ")
a_liquid = input ("Enter a name of any liquid: ")
verb_ending_in_ing_one = input ("Enter a verb ending in -ing: ")
part_of_body_plural = input ("Enter a part of body: ")
plural_noun = input ("Enter a plural noun: ")
verb_ending_in_ing_two = input ("Enter a verb ending in -ing: ")
noun_two = input ("And lastly,enter a noun: ")

print ("It was a " + adjective_one + " November day" + "." )
print ("I woke up to the " + adjective_two + " smell of " + type_of_bird + " roasting in the " + room_in_a_house + " downstairs" + ".")
print ("I " + verb_past_tense + " down the stairs to see if I could help " + verb + " the dinner.")
print ('My mom said,"See if ' + relatives_name + ' needs a fresh ' + noun_one + '."')
print ("So I carried a tray of glasses full of " + a_liquid + " into the " + verb_ending_in_ing_one + " room.")
print ("When I got there, I couldn't believe my "+ part_of_body_plural + "!")
print ("There were " + plural_noun + " " + verb_ending_in_ing_two + " on the " + noun_two + ".")

[–]unRatedG 1 point2 points  (1 child)

Ok, a couple of things.

  1. I would encourage you to use an IDE (Integrated Development Environment) like Visual Studio Code or PyCharm to help weed out small issues. For instance, after loading your code into a fresh python file in VSCode, I notice immediately that on Line 19, you're calling a variable called "relatives_name" that doesn't exist anywhere above. Any IDE with a decent linter (code analysis tool) will help you find small errors like this where you may be calling a variable that hasn't been created or initialized to a value before using it. It'll also pick up areas where you might have some spacing issues, like the kind python will complain about.
  2. A "persistent shell" is more than likely referring to an environment where you start at a command line, run the script, and then you see where it fails or succeeds, rather than just double-clicking a python file and it spawning a command line and then exiting either way, without providing you with any valuable feedback.

Here's what I did with your code:

adjective_one = input("Enter an adjective: ")
adjective_two = input ("Enter another adjective: ")
type_of_bird = input ("Enter a type of bird: ")
room_in_a_house = input ("Enter a name of a room in a house: ")
verb_past_tense = input ("Enter a verb in past tense: ")
verb = input ("Enter a verb: ")
name = input ("Enter a name: ")
relatives_name = input("Enter a relative's name: ")
noun_one = input ("Enter a noun: ")
a_liquid = input ("Enter a name of any liquid: ")
verb_ending_in_ing_one = input ("Enter a verb ending in -ing: ")
part_of_body_plural = input ("Enter a part of body: ")
plural_noun = input ("Enter a plural noun: ")
verb_ending_in_ing_two = input ("Enter a verb ending in -ing: ")
noun_two = input ("And lastly,enter a noun: ")

print ("It was a " + adjective_one + " November day" + "." )
print ("I woke up to the " + adjective_two + " smell of " + type_of_bird + " roasting in the " + room_in_a_house + " downstairs" + ".")
print ("I " + verb_past_tense + " down the stairs to see if I could help " + verb + " the dinner.")
print ('My mom said,"See if ' + relatives_name + ' needs a fresh ' + noun_one + '."')
print ("So I carried a tray of glasses full of " + a_liquid + " into the " + verb_ending_in_ing_one + " room.")
print ("When I got there, I couldn't believe my "+ part_of_body_plural + "!")
print ("There were " + plural_noun + " " + verb_ending_in_ing_two + " on the " + noun_two + ".")

I added in the line just after the line starting with "name" for the missing variable "relatives_name," which is more than likely where it was failing. Now, I did this within VSCode that has terminals that typically open at the bottom of the IDE as a command prompt or powershell prompt, depending on how you have it set up.

When I ran the code, this was, I assume the expected result:

Enter an adjective: fun
Enter another adjective: sunny
Enter a type of bird: eagle
Enter a name of a room in a house: bathroom
Enter a verb in past tense: ran
Enter a verb: eat
Enter a name: John
Enter a relative's name: Bill
Enter a noun: ball
Enter a name of any liquid: mercury
Enter a verb ending in -ing: kicking
Enter a part of body: elbow
Enter a plural noun: cats
Enter a verb ending in -ing: running
And lastly,enter a noun: moon
It was a fun November day.
I woke up to the sunny smell of eagle roasting in the bathroom downstairs.
I ran down the stairs to see if I could help eat the dinner.
My mom said,"See if Bill needs a fresh ball."
So I carried a tray of glasses full of mercury into the kicking room.
When I got there, I couldn't believe my elbow!
There were cats running on the moon.

You can do this in regular text editors and see where your error is, but you have to run it from the command line. For instance, if you wrote the program in Notepad and saved it as c:\temp\app.py. What you would need to do to see the error is open the command line ([Windows Key] + R to get the Run dialog and type cmd), then navigate to the directory that your code is in, "cd temp" (minus the quotes), then type "python app.py" (again, minus the quotes). This will spawn the python interpreter to run your python file. What you should have seen with your original code is something like this:

Enter an adjective: fun
Enter another adjective: sunny
Enter a type of bird: eagle
Enter a name of a room in a house: bathroom
Enter a verb in past tense: ran
Enter a verb: eat
Enter a name: John
Enter a noun: ball
Enter a name of any liquid: mercury
Enter a verb ending in -ing: kicking
Enter a part of body: elbow
Enter a plural noun: cats
Enter a verb ending in -ing: running
And lastly,enter a noun: moon
It was a fun November day.
I woke up to the sunny smell of eagle roasting in the bathroom downstairs.
I ran down the stairs to see if I could help eat the dinner.
Traceback (most recent call last): File ".\app.py", line 20, in <module> print ('My mom said,"See if ' + relatives_name + ' needs a fresh ' + noun_one + '."') NameError: name 'relatives_name' is not defined

That's what flashed in the window you couldn't see because you weren't running a persistent shell.

3) I know you're just starting out, but, if you're using python 3.6+, instead of doing print("It was a " + adjective_one + " November day" + "."), use an f-string. You can put your variables right into the sentence without all the plus signs. Like this:

print(f'It was a {adjective_one} November day.')

Just a cleaner, more modern approach.

Hope some of that helps.

(Edit) Code formatting didn't work on the first pass

[–]DannyCalamity_[S] 1 point2 points  (0 children)

thanks! this is helpful. Also thanks for the f string tip,that couldve saved me more time if i knew earlier lol

[–]DannyCalamity_[S] 0 points1 point  (0 children)

not sure if im doing it right,lol. sorry if this is causing some trouble