Day 091 - Project 91 : The joke's on you!

If you have any questions, comments or issues with this project please post them here!

Hey Guys! I have broken some code for you… Can you please fix it?
Haha :crazy_face:

Now, seriously, here’s my problem:

I get an interesting ValueError: Circular Reference detected when trying to store the joke to the replit database.

I know it’s probably because of my functions, but I don’t see, why it shouldn’t work…

Can you please enlighten me? :pray:

import requests, json
from replit import db

def joke():  
  result = requests.get("", headers={"Accept":"application/json"}) 
  joke = result.json()["joke"]
  id = result.json()["id"]
  return joke, id

def save(joke, id):
  db[id] = joke
  print("Joke saved")

def view():
  for key in db.keys():

def menu():
  print("The Joke's on You!\n")
  select = input("Generate random Joke or view Joke-Database?\n1: Random Joke\n2:View Jokes\n")
  if select == "1":
    store = input("Save this Joke?\nYes/No:\t").lower()
    if store[0] == "y":
  if select == "2":
  select = input("press enter when done")
while True:

Thanks :kissing_closed_eyes:

You have a var passed to a function called “joke”, and you have a function called “joke”, try renaming one or the other.

And here:

1 Like

Thank You @Firepup650 ! - too easy :sweat_smile: :sweat_smile: