Get startedGet started for free

Generating a table

Imagine you are a developer working for a renowned online bookstore known for its extensive collection of science fiction novels. Today, you have a task at hand: to create a table of ten must-read science fiction books for the website's homepage. This will enhance the user experience on the website, helping fellow sci-fi enthusiasts discover their next great read.

The OpenAI package and the get_response() function have been pre-loaded for you.

This exercise is part of the course

ChatGPT Prompt Engineering for Developers

View Course

Exercise instructions

  • Craft a prompt that generates a table of 10 books, with columns for Title, Author, and Year, that you should read given that you are a science fiction lover.
  • Get the response.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

client = OpenAI(api_key="")

# Create a prompt that generates the table
prompt = ____

# Get the response
response = ____
print(response)
Edit and Run Code