print("Hello, World!")
Hello, World!
Python randomizer
This documents my attempts to create a Python program using an LLM. The purpose of the program is to choose a random order for students to make presentations about their prompt engineering exploits to the Prompt Engineering class.
The constraints are that
This program could operate in many different ways.
For example, it could print out twelve rows of three or four numbers in each row, with each row representing one date. The numbers must be in the set 1 to \(\langle\) number of students in the class \(\rangle\). In that case, no number must be repeated and every number must be included. Then the numbers can be matched to an alphabetical list of students.
As another example, the program could read in a list of student names and spit them out in a random order, with a line ending after every three. Since there are currently 36 students in the class, if I did this today, there would be three students for each day. But this strategy might be problematic if some students drop the course.
There is a Python random
module, which can be used in several different ways to randomize.
Many prompt engineering opportunities exist. You could look at https://news.ycombinator.com/item?id=42584400 and the linked article for ideas about prompt engineering with Python. (A very different perspective is available at https://news.ycombinator.com/item?id=42617645 )
First, I’m going to check that Python is running.
print("Hello, World!")
Hello, World!
If I press the green triangle above and to the right of the Python code chunk, I should see Hello, World! printed in a box. (When I render the document, the code will be in a box but the output will be in the body of the document unless I add some other options.)
A more elaborate example of a Python chunk follows.
#. This is a comment
import numpy as np
import matplotlib.pyplot as plt
= np.arange(0, 2, 0.01)
r = 2 * np.pi * r
theta = plt.subplots(
fig, ax = {'projection': 'polar'}
subplot_kw
)
ax.plot(theta, r)0.5, 1, 1.5, 2])
ax.set_rticks([True)
ax.grid( plt.show()
Please always leave a blank line before and after Python chunks as well as leaving a blank line before (but not necessarily after) headings.
By the way, this is a cross-reference to Figure 1
Here is where you put the first prompt you tried in writing the code.
Here is where you put the result of the first prompt you tried.
Here is a refined prompt.
Here is the result of the refined prompt.
Here is the prompt that actually gave you the desired result.
Here is the Python fragment that actually achieves the goal of the program.
(Just kidding about fifteenth—I don’t know how many attempts it will take to get a satisfactory result)
Here is where you describe what you did and any thoughts about how it came out.
You should also show the application of the Python program and any manual processing it requires, such as combining the list of numbers with a list of students in the class. The result should be a complete solution to the problem, requiring no further processing.
toc
causes the table of contents to be rendered, on the right side of the frame by defaultembed-resources
causes any diagrams to be included in the html file itself rather than linked—that way you can just submit the html file and I can view it instead of having to submit linked filespython
in curly braces, followed by the code, followed by a line with three backticks and a blank linefig-cap
which causes a caption to be printed, and fig-label
which creates a label that can be used to reference the figurerandom
module of Python … this causes the keyword to be rendered in a code fontOf course, you will delete all the instructions and comments in this file before you turn it in! I don’t need to read them when I read your solution. The files you turn in (the qmd and the rendered html) will just include your work. These instructions and comments are just to help you get going.