AI Prompt Examples

Below are example prompts developed by ODE along with sample outputs from ChatGPT.

Example Prompt:

I'm taking a mid-level computer science course on object oriented programming leveraging C++. I need some help understanding some concepts, could you help me? My instructor gave us the following example in class. Can you help me understand what's happening in this code?

#include <iostream>
#include <stack>
using namespace std;
int main() {
    stack<int> stack;
    stack.push(21);// The values pushed in the stack should be of the same data which is written during declaration of stack
    stack.push(22);
    stack.push(24);
    stack.push(25);
    int num=0;
      stack.push(num);
    stack.pop();
    stack.pop();
      stack.pop();
   
    while (!stack.empty()) {
        cout << stack.top() <<" ";
        stack.pop();
    }
}

Example Output:

Certainly! This code is a simple example of how to use the STL stack container in C++. Let's break down what's happening step by step:

  1. Including Libraries:
    • #include <iostream> includes the input-output stream library, which allows you to perform standard input and output operations.
    • #include <stack> includes the library for the stack container, which provides a Last In, First Out (LIFO) data structure.
  2. Using Namespace std: using namespace std; allows you to use standard library names without the std:: prefix.
  3. Main Function: The int main() function is the entry point of the program.
  4. Stack Declaration: stack<int> stack; declares a stack of integers.
  5. Pushing Values into the Stack:
    • stack.push(21);
    • stack.push(22);
    • stack.push(24);
    • stack.push(25);
    • These lines push the respective integer values onto the stack.
    • int num = 0; and stack.push(num); - These lines declare an integer num with value 0, and then push that value onto the stack.
  6. Popping Values from the Stack:
    • stack.pop(); is called three times, which removes the three most recently added values from the stack (0, 25, and 24).
  7. Printing and Popping the Remaining Values:
    • The while loop checks if the stack is not empty using !stack.empty().
    • Inside the loop, stack.top() returns the value on the top of the stack and prints it to the console.
    • stack.pop(); is called to remove the value from the top of the stack.
    • This loop continues until the stack is empty.

After running the code, the output will be: 22 21

The values are printed in reverse order of how they were pushed onto the stack because the last value pushed on is the first one popped off, which is the fundamental behavior of a stack.


Example Prompt:

I am interested in improving my general physical health as a 40 year old man. Develop a workout plan where I go to the gym three days a week. It should include a mix of running and weight lifting. Include healthy dinner ideas that do not have red meat as an ingredient. To get started, ask me a list of at least 15-20 questions about everything you need to know about me in order to create a tailor-made fitness and nutrition plan for me. Make sure you include questions about my goals, limitations, and preferences.

Example Output:

Certainly! Here are the questions that will help me create a personalized fitness and nutrition plan for you:

Fitness Questions:

  1. What are your specific fitness goals (e.g., weight loss, muscle gain, overall toning)?
  2. Have you been involved in any physical activities or exercise routines before? If so, what have they been?
  3. Do you have any physical limitations or injuries that need to be considered when developing the exercise plan?
  4. What's your current weight and height?
  5. Do you have access to specific gym equipment (e.g., treadmill, free weights, machines)?
  6. How comfortable are you with weight lifting? Are you a beginner, intermediate, or advanced lifter?
  7. What is your current running ability (e.g., distance, pace)?
  8. Are there any exercises or physical activities that you particularly enjoy or dislike?
  9. How much time can you devote to each gym session?
  10. Would you like to include any flexibility or mobility exercises in your routine?

Nutrition Questions:

  1. Are you allergic to any foods or have dietary restrictions that need to be considered?
  2. What are your nutritional goals (e.g., weight loss, muscle gain, maintaining weight)?
  3. Do you have any preferences for specific cuisines or types of food?
  4. How comfortable are you with cooking, and do you have time to prepare meals?
  5. Are there any specific foods or ingredients you'd like to include or avoid besides red meat?
  6. What's your typical eating pattern (e.g., number of meals and snacks per day)?
  7. Do you prefer quick and easy meals, or are you open to more complex recipes?
  8. Would you like to include supplements such as protein shakes in your meal plan?
  9. Are you currently following any specific diet or eating pattern (e.g., vegetarian, gluten-free)?
  10. How do you usually stay hydrated, and would you like guidance on water intake?

Please take your time to answer these questions, and feel free to provide any additional information you think would be relevant.


Example Prompt:

Using the Canvas LMS API write a Python script that does the following:

  1. Take input of course ID
  2. Take input of student login ID
  3. Take input of end date
  4. Create a new section called "Extended Access" within the course provided. The section should have a start date of current day and an end date of the date provided in step 3 and restrict student participation to those dates.
  5. Enroll the student from step 2 in the newly created section.
  6. Enroll the instructor of the course in the newly created section.

Example Output:

Here's an example Python script that uses the Canvas API to achieve the requested tasks. Before you use this script, make sure you have the "requests" library installed in your Python environment. You can install it using pip:

pip install requests

Also, replace YOUR_ACCESS_TOKEN with your actual Canvas API access token:

import requests
import datetime

# Define your Canvas domain and access token
CANVAS_DOMAIN = 'https://your-school.instructure.com'
API_URL = CANVAS_DOMAIN + '/api/v1'
ACCESS_TOKEN = 'YOUR_ACCESS_TOKEN'

headers = {
    'Authorization': 'Bearer ' + ACCESS_TOKEN,
}

# 1. Take input of course ID
course_id = input('Enter course ID: ')

# 2. Take input of student login ID
student_login_id = input('Enter student login ID: ')

# 3. Take input of end date
end_date = input('Enter end date (YYYY-MM-DD): ')

# 4. Create a new section called "Extended Access"
create_section_url = f"{API_URL}/courses/{course_id}/sections"
current_date = datetime.datetime.now().isoformat()
payload = {
    'course_section[name]': 'Extended Access',
    'course_section[start_at]': current_date,
    'course_section[end_at]': end_date,
    'course_section[restrict_enrollments_to_section_dates]': 'true'
}
response = requests.post(create_section_url, headers=headers, data=payload)
section_id = response.json()['id']

# 5. Enroll the student from step 2 in the newly created section.
# First, we need to retrieve the student's user ID from their login ID
get_user_url = f"{API_URL}/accounts/self/users?search_term={student_login_id}"
response = requests.get(get_user_url, headers=headers)
user_id = response.json()[0]['id']

enroll_student_url = f"{API_URL}/sections/{section_id}/enrollments"
payload = {
    'enrollment[user_id]': user_id,
    'enrollment[type]': 'StudentEnrollment',
    'enrollment[enrollment_state]': 'active'
}
response = requests.post(enroll_student_url, headers=headers, data=payload)

# 6. Enroll the instructor of the course in the newly created section.
# First, we need to retrieve the course's instructor ID
get_course_url = f"{API_URL}/courses/{course_id}?include[]=teachers"
response = requests.get(get_course_url, headers=headers)
teacher_id = response.json()['teachers'][0]['id']

enroll_teacher_url = f"{API_URL}/sections/{section_id}/enrollments"
payload = {
    'enrollment[user_id]': teacher_id,
    'enrollment[type]': 'TeacherEnrollment',
    'enrollment[enrollment_state]': 'active'
}
response = requests.post(enroll_teacher_url, headers=headers, data=payload)

Note:

  • You should replace your-school.instructure.com with the URL of your school's Canvas instance.
  • This script assumes the first teacher of the course is the instructor to be enrolled in the section. If there are multiple teachers, you may need to modify the script accordingly.
  • Error handling is not included in this script. You should add appropriate error handling for production use. For example, checking the HTTP status codes of the responses to ensure the requests were successful.
  • The script assumes the provided end date is in the format 'YYYY-MM-DD'.

Example Prompt:

I'm writing a paper about the the Ubaid period. Can you help me with a basic outline and a list of sources I can use to research?

Example Output:

[Only a portion of output displayed for brevity's sake]

Certainly! The Ubaid period is an important phase in the prehistory of the Mesopotamian region, dating from around 6500 to 3800 BCE. Here's a basic outline you can use for your paper, and some reputable sources to assist with your research.

Outline

  1. Introduction
    • Definition of the Ubaid period
    • Geographical context
    • Importance in understanding Mesopotamian prehistory
  2. Chronological Framework
    • Ubaid 0/Pre-Ubaid (6500–5300 BCE)
    • Ubaid 1 (5300–4700 BCE)
    • Ubaid 2 (4700–4500 BCE)
    • Ubaid 3 (4500–4100 BCE)
    • Ubaid 4 (4100–3800 BCE)
  3. Cultural Characteristics
    • Settlement Patterns
    • Architecture
    • Pottery
    • Economy and Agriculture
    • Social Structure and Religion

Sources

  1. Adams, R. M. (1981). Heartland of Cities: Surveys of Ancient Settlement and Land Use on the Central Floodplain of the Euphrates. Chicago: University of Chicago Press.
  2. Carter, R. and Philip, G. (2010). Beyond the Ubaid: Transformation and Integration in the Late Prehistoric Societies of the Middle East. Chicago: Oriental Institute of the University of Chicago.
  3. Oates, J. (2005). Art and Architecture of the Ancient Orient. New Haven: Yale University Press.
  4. Stein, G. (1999). Rethinking World-Systems: Diasporas, Colonies, and Interaction in Uruk Mesopotamia. Tucson: University of Arizona Press.
  5. Journal Articles and Publications:
    • Journal of Near Eastern Studies
    • Antiquity
    • Iraq (published by the British Institute for the Study of Iraq)

You may find these books and journals in university libraries or online academic databases. If your university has access to online resources like JSTOR, that can be an invaluable tool for accessing scholarly articles on the subject. Happy writing!

Details

Article ID: 10641
Created
Mon 8/14/23 11:09 AM
Modified
Fri 8/18/23 12:29 PM