Hello, I need help. I need to create this program in Python. Decide on an interactive conversation someone could have with a computer. Your program should include at least three interactive prompts. Input from the user should be assigned to variables and used throughout the conversation. At least once, use the indexing or slicing technique. Use concatenation to join string literals and string values.
I came up with this but don't know what is wrong. # 1.05 Conversation def main(): language = input("Do you speak English or Spanish/haces hables ingles o espanol?") if language == "English": firstname = input("What is your first name?") lastName = input("What is your last name?") question1 = input("Hello, " + firstName + lastName + " how are you?") print("- Terminator: Hello," + firstName + lastName + " how are you?") print("- English user: " + question1 + ".") question2 = input ("What is your favorite hobby?") print("- Terminator: What is your favorite hobby?") print("- English user: " + question2 + ".") print("- Terminator: That's my favorite hobby too!") print("- Terminator: Gotta go, more users to talk to. Bye!") if language == "ingles": firstname = input("What is your first name?") lastName("What is your last name?") name(firstName + lastName) question1 = input("Hello, " + name + " how are you?") print("- Terminator: Hello," + name + " how are you?") print("- English user: " + question1 + ".") question2 = input ("What is your favorite hobby?") print("- Terminator: What is your favorite hobby?") print("- English user: " + question2 + ".") print("- Terminator: That's my favorite hobby too!") print("- Terminator: Gotta go, more users to talk to. Bye!") if language == "Spanish": firstName = input("Como te primero llamas?") secondName = input("Como te segundo llamas?") question1 = input("Hola, " + firstName + secondName + " como estas?") print("- Terminator: Hola, " + firstName + secondName + " como estas?") print("- Tu: " + question1 + ".") question2 = input("Cual es tu pasatiempo favorito?") print("- Terminator: Cual es tu pasatiempo favorito?") print("- Tu: " + question2 + ".") print("- Terminator: Adios.") if language == "espanol": firstName = input("Como te primero llamas?") secondName = input("Como te segundo llamas?") question1 = input("Hola, " + firstName + secondName + " como estas?") print("- Terminator: Hola, " + firstName + secondName + " como estas?") print("- Tu: " + question1 + ".") question2 = input("Cual es tu pasatiempo favorito?") print("- Terminator: Cual es tu pasatiempo favorito?") print("- Tu: " + question2 + ".") print("- Terminator: Adios.") main()
Okay, one second
UnboundLocalError: local variable 'firstName' referenced before assignment on line 8
It's saying that you used first name already.
But, I would check again, when I copied and pastesd the lines, nothing came up.
are you on mobile or pc?
Pc
whenever you run the program, you should see an input box at the top of the window
Yes, I see it, but like I said, nothing came up when I put the lines in.
did you type English with a capital E?
did you type English with a capital E?
did you type English with a capital E?
Yes
hmm
One second, brb.
Ultriliam should be back soon.
ok, thanks
He's an expert at computer science.
Ultriliam's narcolepsy is acting up right now and he's about to pass out :zzz:
oh
I have to do it, the only people who are experts offline.
It's interactive shell, right?
umm
idk
there is an arrow that takes you there.
its python idle
Ok
could you get me a link to Python Idle.
https://learn.flvs.net/webdav/educator_foundofprog_v16/global/interactives/python_idle/python_idle.htm does that work?
No it does not work This is what it says The system is unable to access the cookie that was assigned to your computer upon login. The most likely cause of this problem is an improper access to the course via a bookmark, browser window that was left open, or an improper exit from the system. To resolve the problem you will need to: Log into your course Delete your browser cookies Click the "Logoff" button Reboot your computer Sign back into your account Make sure you properly logoff and close your browser window each time you exit the system If you need assistance resolving this problem please follow the steps below: Click on the "Technical Support" link within your course. Click the "Educator Help Desk" sublink, located just below the "Technical Support" button you just clicked. Select that the "Nature of your problem" is with the "Educator System". This will route the request to our team. In the problem description field, provide a brief description of the problem you are experiencing. In this case, something along the lines of "When I click on Lessons I get a cookie error" will be more than sufficient. When you click the "Submit" button this will send your problem description to our team along with your account information and some information about the browser you are using. We will then reset your account as quickly as possible and provide you with the appropriate steps to reset your browser on your computer.
hmm i use it through my FLVS course
\(\color{#0cbb34}{\text{Originally Posted by}}\) @Aqual hmm i use it through my FLVS course \(\color{#0cbb34}{\text{End of Quote}}\) Is it on the FLVS lessons?
yes
\(\color{#0cbb34}{\text{Originally Posted by}}\) @Aqual yes \(\color{#0cbb34}{\text{End of Quote}}\) Depending on the course you can share the lesson here if they give an 'LTI pass through' site, otherwise you'll have to take a screenshot
I don't know what I can do, you might have to wait for the experts. They are offline right now, and Ultrialiam is tired.
\(\color{#0cbb34}{\text{Originally Posted by}}\) @Aqual UnboundLocalError: local variable 'firstName' referenced before assignment on line 8 \(\color{#0cbb34}{\text{End of Quote}}\) What this means is that you are referring to something that currently doesn't exist. Let's say I was at a party and I had a group of friends named Timmy and Tom. Now let's assume that I call up some other person's name who isn't in my friend group. Let's say I call "John". Because there is no "John" that anybody would know of, everybody would be confused. That is what is happening here. That's what it means. Now I see where this issue is. You may not believe this, but I found a really small issue that ruins it all.
Take a look at this screenshot and look at the variable names. Problem solved.
firstname does not equal firstName
OMG Thank you so much
Your welcome.
Is that all?
yes
Join our real-time social learning platform and learn together with your friends!