Software engineering has a steep learning curve early on. Not knowing how to start, how to structure, how to debug has meant hours of frustration for beginner software engineers. And most of the time, these hours could have been saved if a helpful tutor had been available with a couple of pointers or examples.
We decided to see if could write a simple program by prompting ChatGPT and not programming a single line.
Prompt: Can you recommend an approach to extract the main headlines from a newspaper such as the nytimes via a Python program
ChatGPT: Certainly! Extracting the main headlines from a newspaper like The New York Times using a Python program typically involves web scraping and parsing HTML content.
Prompt: What if i don't want to scrape the page, is there another way ?
ChatGPT: If you don't want to scrape the webpage directly, you can explore alternative options for obtaining the main headlines from The New York Times. Here are a couple of alternatives:
NYTimes API: The New York Times provides an API that allows you [...]
RSS Feeds: The New York Times offers RSS feeds that provide a structured format of their content, including headlines. [...]
Prompt: I like the RSS approach. Can you write a simple python program which extracts the main world feeds and prints them out in a readable way with a brief summary ?
ChatGPT: Generates
this file with explanations. The program works as requested (
example output here) and is an easy example of iterating through a list and printing specific data
Prompt: Can you generate a web page with this data, and add an image for each feed entry ?
ChatGPT: Generates
this file with explanations. The program works as requested (
example output here) and demonstrates how to print out into special templates (e.g. HTML)
Prompt: Can you update the code to send me an email with a synthesis of the headlines by email ?
ChatGPT: Generates
this file with explanations. The program works as requested and demonstrates how to interact with more advanced libraries to make an API call to an email server
Such tutoring is invaluable in getting started, and we're excited that it makes programming more accessible to millions of people.
However a word of caution:
don't think that being able to chat with ChatGPT makes you de facto a programmer. There too is a learning curve on knowing what and how to prompt an LLM, similarly to learning to use the Google search engine. For example: "explain this piece of code", "how can we make the algorithm more modular", "can we write test cases" etc. The better you understand what you are doing, the more you know how to ask specific prompts, the better you understand... it's a virtuous circle.
We'll continue working with ChatGPT to write better code and we'll give some updates when we figure out how to use it in further unexpected ways.