Totally lost, i need some guidance and explanations please

Question: I need help as I do not know to whom I shall ask for help. lost

Repl link: Takeoff School: Your 1st AI App - Replit

code snippet import os
import openai

openai.api_key = os.getenv("OPENAI_API_KEY")

question = input("\033What is your question?\n\033[0m")

#completion = openai.ChatCompletion.create(
 # model="gpt-3.5-turbo",
  #messages= [{"role": "system", "content": "You are a helpful assistant. Answer the given question."},
   #          {"role": "user", "content": question}]
#)
print(question)
# Add a condition to exit the program 
if question.lower == "exit":
  exit(). 

Hello @nskadi!
Could you please provide the error/problem that occurs?
To copy the error, you can highlight the text you wish to copy, right-click, and then press copy.

2 Likes

To start thank you so much for responding, what I am facing is running, once I run the code it keeps running despite my inputs, plus if you notice it is supposed to add color, but it won’t, and if I put the question like What is Paris? The


output is an error yet in the instructions everything runs smoothly and, I am following the instructions step by step, I repeat them many times, but the same problem is still there. here are the input and output: Great, i have my code:

import os
import openai

openai.api_key = os.getenv("OPENAI_API_KEY")

question = input("What is your question?\n")

#completion = openai.ChatCompletion.create(

model="gpt-3.5-turbo",
#messages= [{"role": "system", "content": "You are a helpful assistant. Answer the given question."},

{"role": "user", "content": question}]
#)
print(question)

and the output is:

What is your question?
2 + 2
2 + 2
 2 + 2
4
 3 + 3
6
 What is Paris
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'What' is not defined
 what is paris
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'what' is not defined
 What is Paris?
File "<stdin>", line 1
What is Paris?
^
SyntaxError: invalid syntax
 4 + 4
8
 hold()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'hold' is not defined


plus it kept on running until i stopped it!

Please format your code like this: ```your code here```.

1 Like

I think I have found the issue. The
image
symbols are not part of your program. Your program uses the older console because your Repl’s tutorial was made before the new console update happened. You may want to create a new Repl and just copy-paste the Python code there, and follow along the tutorial on the original repl.

2 Likes

Thank you thank you so so much, very kind of you to help and guide me, I will follow your instructions, thank you sir so much again.

2 Likes

If my post solved your problem, please press the solution button for this post.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.