Blogging, Current Events, Poetry, Technology, Writing

Sunday Scribblings #164: Code Poetry: Exploring The Magic of..

Code poetry is cool, and for those who love coding and poetry, there is various ways of exploring the magic of the same. Read on for more..

This post contains Amazon and other affiliate links, that at no additional cost to you, I may earn a small commission. Thank you for your support. Please see the full disclosure for more information. I only recommend products I definitely would (or have already) use myself

Notepad and a pen over it with a cup of coffee next to it. words read Sunday Scribblings, and this is for Sunday Scribblings #164: Code Poetry: Exploring The Magic of..

Poetic Sundays: Code Poetry

I picked up code poetry for this week’s poetic Sundays for I saw that it is National Ladies Learning Code Day on November 6 (in Canada, but we can all celebrate it, right!).

So What is Code Poetry?

Put simply, code poetry combines classical poetry and computer code. Code poems can be read as poetry and executed as code (as always, there are exceptions). They can be written with a literary meaning in mind, and can tell a story, convey a message, or showcase the beauty of programming poetry.

Code Poetry’s Characteristics

So code poetry’s elements are that at its most basic, it is:

  • code! (code that can be run, as much as possible, or not)
  • poetry!
  • free of rules of rhyme or meter

Tips for Writing Code Poetry

Code poems blend the logic and structure of code with the emotional and creative aspects of poetry, resulting in a creative piece that can be both technically functional and artistically meaningful.

Here are a few tips to write code poetry:

Choose a Concept or Theme

Start by selecting a concept, theme, or idea. You could use a personal experience, or make your poem a social commentary. Or it can be about nothing at all (like the Seinfeld show!), and even abstract things.

Select a Programming Language

Decide the language you want to code your poem in. Different languages can evoke different moods and styles, so choose one that suits your concept. Popular languages for code poetry include Python and JavaScript as well as Perl

Write the Code… Well, Poetry… I mean Code Poetry

Start coding with a focus on readability and aesthetic quality. As you write, keep your eye on the structure and flow to not only evoke emotions or retain beauty, but also keep the coding aspect intact. It should look, feel, and sound like both code and poetry after all – the merge should be seamless.

Embrace Poetic Elements

  • Use descriptive variable and function names that resonate with your theme.
  • Employ formatting, indentation, and whitespace creatively to structure your code visually.
  • Consider the rhythm and flow of the code, just like you would with traditional poetry.

Craft Meaningful Comments

Like in programming, your comments are an integral part of code poetry. Write comments that provide context, explanation, and enhance the poetic aspect of your work. Include some of them as lines of poetry.

Create Visual Art

Some code poems incorporate visual elements through ASCII art or graphical representations within the code, enhancing the aesthetic appeal of your creation.

Bonus Tips to Make it More Fun

  • Pun and Wordplay: You know I love puns and wordplay. You can try to incorporate them into your variable names, comments, or code structure. How about a comment like “This code is knot afraid of loops!”
  • Easter Eggs: Hide surprises, aka Easter eggs, in your code. These can be unexpected behaviors, comments, or humorous messages that the reader discovers when running or analyzing your code.
  • Coding Challenges: Create coding challenges within your code poetry. Make the reader interact with the code in a playful way, such as solving riddles, puzzles, or mini-games embedded in the code.
  • Interactive Narratives: Turn your code poetry into an interactive story or choose-your-own-adventure experience. This allows the reader to engage with the code and have fun while navigating through different paths and outcomes. Add playful game-like features, such as rewards, achievements, or funny character interactions
  • Memes and References: Incorporate internet memes, pop culture references, or inside jokes that resonate with your target audience. Just ensure that the references are relevant and not overly obscure.
  • Play with Visual Effects: Experiment with visual effects in the terminal or console, such as changing text colors, animations, or other dynamic elements that create a visually entertaining experience.
  • Use Sound and Music: If appropriate, you can add sound effects or background music that plays when the code is executed. This can add an extra layer of fun and interactivity.

Reference, h/t, and further reading

My Attempt

Running this in an online Python compiler will ask the user to enter their candies (line 2 in response below)..


On My Blog

On the Homefront

A regular kind of week here this past week. I got over jetlag. We visited a couple of temples in the Bay Area that we had not earlier, and in one of them, had someone walk over to me and say “We met at the airport – that day when our flight was delayed by seven hours!!” (Yes it really was. And a more patient group of passengers you would and will never meet) While the delay was frustrating indeed (without a proper reason on top of that), I made many friends and hope to keep in touch with them going forward. Case in point – the temple meetup meant I have one more contact on my phone now.

Chats with friends warmed my heart as they called me to talk about my mom.

I still keep feeling my days are incomplete as I have not made my customary call to mom (and I cannot, though my brother still has kept her phone number active and has mentioned that he will leave it that way for a while yet). My mind knows that she is no longer there but my heart – well, it beats a different tale.


On My Blog and On the Homefront

Hoping to continue life stories and family stories on IG and here along with a few artsy crafty books I am excited to feature this week. And then it is the long weekend as well as a festive weekend with Deepavali on the 12th. While I am not fully ready to celebrate it at this time, I do know the festive season is all around us, literally!


Literary Celebrations (close-to-it also!)

  • Literary birthdays this week include: Colson Whitehead and James Jones on Nov 6th; Albert Camus, Sabaa Tahir, and Yuyi Morales on the 7th of November; Bram Stoker, Margaret Mitchell, Raja Rao, Lauren Oliver, and Kazuo Ishiguro on Nov 8th; Anne Sexton, Janet Fitch, and Carl Sagan on Nov 9th; Oliver Goldsmith, Caroline Kepnes, and Neil Gaiman on 10th Nov; Kurt Vonnegut, Carlos Fuentes, Abul Kalam Azad, and Fyodor Dostoevsky on Nov 11th; DeWitt Wallace on Nov 12th
  • Fall Children’s Book Week is Nov 6 – 12, 2023.
  • It is apparently – Abet and Aid Punsters Day on November 8th.. every year too.. 🙂
  • Nov 12th is National Chicken Soup for the Soul Day
  • International Tongue Twister Day – Second Sunday in November
  • It is National Book Award Week (Nov 7 – 13th)

Foodie Celebrations

Other Celebrations and Observations

Wrapped Up: My Sunday Scribblings

So dear reader, you have reached the end of this Sunday Scribblings! As always, I welcome your thoughts, comments, and suggestions about this post. Will you be attempting to write some code poetry? or maybe code some poetry? And as always, do let me know if you plan to celebrate any of these mentioned celebrations this coming week/month?

Linking this to the Sunday Post over at the Caffeinated Reviewer and the Sunday Salon.

11 thoughts on “Sunday Scribblings #164: Code Poetry: Exploring The Magic of..

Leave a Reply

Your email address will not be published. Required fields are marked *