Console is not showing the output though my code in correct

Replit Profile: https://replit.com/@mafruhatarannum

Hey, @mafruhatarannum welcome to the forums!

Can you please provide a link to the repl? This way it is easier for staff and members of the community to help you!

Also see this guide on how to share your code:

2 Likes

Please fill in all questions in the template (if any) and provide the link to your repl next time.
By comparing your replit account’s last-change time of repls and timing of this post, I assume the repl you’re having trouble with is this one, however, the reason why there is no output might be caused by 3 reasons.

  1. You haven’t set the environment variable (aka secrets in replit) OPENAI_API_KEY, which caused openai package to be unusable, and it errored out.
  2. Your internet connection is too slow that it disconnects and restarts your repl everytime you try to run it, which it ends before any output line is reached
  3. your code is NOT correct, please check if you suspect this is the reason
2 Likes

Hello @mafruhatarannum, welcome to replit ask!

Could you please provide the link to the specefic repl that you’re talking about? If we have the link, we can diagnose the problem much easier. Also, what is the specific problem you’re having? Please provide more details.

Thanks,
Esb678

Hello @Esb678 ,Thank you for you kindness. Here is the link.
https://replit.com/@mafruhatarannum/Exponent

Hi @NateDhaliwal !Thank you for your kindness . But i can not post the link .I tried to post the link but it failed .Sorry . Again thank you for your kindness .

Thank you for the link @mafruhatarannum. I forked the project, and it seems like it is outputting correct. I noticed that you had these comments:

# arithmetic = 5**2
# print(arithmetic)

If you remove the #, it is no longer a comment, so the code would output. It’s possible that you accidentally commented out part of your code, so the parts with the # next to them will not output anything, and the console will treat it like nothing is there. If you un-comment it out, the code will now run, and this would be the code and the output:

Code:

arithmetic = 5**2
print(arithmetic)
print(3+9)

Output:

25
12

In Python, ** is the syntax for an exponent, so 5^2 = 25. Is this your desired output?

Here is the version I forked: https://replit.com/@Esb678/Exponent

Hope this helps,
Esb678

2 Likes

Thank you @Esb678 for fixing my problem . Thank you again… :blush:

1 Like

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