BaşlayınÜcretsiz Başlayın

Code generation with problem description

You work as an analyst for a retail company and analyze monthly sales data. You need to develop a Python function that accepts a list of 12 numbers representing sales for each month of the year and outputs the month with the highest sales value. This information will help your company identify the most profitable month. You feed the problem description to a language model to get help.

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

Bu egzersiz

Prompt Engineering with the OpenAI API

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Craft a prompt that asks the model to write a Python function that receives a list of 12 floats representing monthly sales data as input and, returns the month with the highest sales value as output.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

client = OpenAI(api_key="")

# Craft a prompt that asks the model for the function
prompt = ____

response = get_response(prompt)
print(response)
Kodu Düzenle ve Çalıştır