MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Prompt Engineering with the OpenAI API

Lihat Kursus

Petunjuk latihan

  • 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.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

client = OpenAI(api_key="")

# Create a prompt that generates the table
prompt = ____

# Get the response
response = ____
print(response)
Edit dan Jalankan Kode