Home Artificial Intelligence Steal These Prompts to Learn Python Quickly using ChatGPT

Steal These Prompts to Learn Python Quickly using ChatGPT

Steal These Prompts to Learn Python Quickly using ChatGPT

Learning Python has never been easier.

Photo by Azamat E on Unsplash

Learning Python has develop into easier because of ChatGPT.

Besides the countless courses and guides on the market, we are able to now have a private assistant that may enhance the way in which we learn Python 24/7.

We only need to make use of good prompts to take advantage of ChatGPT when learning Python. Listed below are a few of them, which shall be useful whether you’re a latest or experienced programmer.

Create a roadmap to check Python with ChatGPT

Persistently I discussed how necessary is to construct our own curriculum to learn technical things and Python isn’t an exception to this.

It is best to consider making a customized curriculum that helps you give attention to the Python stuff that you simply’ll need more in your field.

Here’s the prompt to make use of.

Act as a programming mentor. I need to learn Python for [field of interest]. Create a roadmap to learn Python each week and add resources to check each week

Say you’re learning Python for data science.

Now, that was a quite simple prompt. I could add some background details about me just like the programming concepts I already know to customize the result a bit more.

Ask for alternative solutions

When solving coding exercises, we are likely to accept the approach that gets the job done after which move on to the following exercise.

Although that isn’t unsuitable, we could enhance our learning by asking ChatGPT for alternative solutions. You may get solutions with fewer lines of code, faster code execution, or a rise in efficiency!

For instance, say I actually have to resolve the exercise below.

# Write a program in Python to show every item of an inventory into its square

numbers = [1, 2, 3, 4, 5, 6, 7]

The very first thing that involves my mind is using a for loop and appending the square numbers to a latest list.

That gets the job done but it surely may not be one of the best solution. Let’s see what ChatGPT has to say.

Show me different approaches to resolve the exercise below.

Exercise: Write a program in Python to show every item of an inventory into its square. numbers = [1, 2, 3, 4, 5, 6, 7]

As you possibly can see, ChatGPT showed me alternative solutions using list comprehension and the map function.

Brainstorm unique projects

The most effective option to learn to code is by doing, which suggests that you must start solving projects asap!

The issue is that the usual projects on the market (snake game, titanic, etc) may not be attractive enough for us to finish it.

That’s when ChatGPT is useful — we are able to use ChatGPT to give you cool and unique project ideas based on the programming knowledge we’ve and things we like.

Here’s the prompt to make use of.

Act as a programming mentor. I’m learning Python and have already learned [topic 1, topic 2, …]

What Python projects can I solve? Consider that I like [thing 1, thing 2, …]

Say we followed the curriculum created before and already learned the stuff in weeks 1 and a couple of. Here’s the result I got.

As you possibly can see, the projects will not be limited to the topics I do know (which is cool because I can learn latest stuff) and likewise consider things I like resembling automating stuff, learning foreign languages, and football.

But that’s not all!

After picking up a project I can ask for the steps to resolve it (without making ChatGPT to jot down the code for me).

Say I picked up a football project. ChatGPT can provide the steps to resolve it.

And for every step, you possibly can ask for more guidance. Say I would like help with step 1 “Collect data.”

Cool isn’t it? A personal programming tutor available for us 24/7!

Note: Unique projects may even show you how to in job interviews. Why? Because those projects won’t be on the resume of many candidates.

Add comments to other peoples’ code

I’ve heard this phrase over and over.

Code is read ten times greater than it’s written

That’s true. We actually spend a number of time reading other people’s code when learning to code and even at work!

The issue is that almost all of the code we read on GitHub or anywhere else isn’t properly commented (or doesn’t have comments in any respect!), so it’s a very good idea to ask ChatGPT so as to add comments to the Python scripts you read.

For instance, in one among my YouTube tutorials, I forgot so as to add comments to the code below (sorry about that!).

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
import pandas as pd
import time

path = '/Users/frankandrade/Downloads/chromedriver' # your path goes here
service = Service(executable_path=path)
website = 'https://forms.gle/YuQczM1pVUxnkuWL9' # your personal form goes here
driver = webdriver.Chrome(service=service)

df = pd.read_csv('fake_data.csv')

for i in range(0, len(df)):
for column in df.columns:
text_input = driver.find_element(by='xpath', value=f'//div[contains(@data-params, "{column}")]//input | '
f'//div[contains(@data-params, "{column}")]//textarea')
text_input.send_keys(df.loc[i, column])
submit_button = driver.find_element(by='xpath', value='//div[@role="button"]//span[text()="Submit"]')


But now, you possibly can simply copy the code from my GitHub and ask ChatGPT the next.

Add inline comments to the code below and explain what’s doing.


Great! Now you possibly can have a greater understanding of the script as a complete and know what each line of code does.

Translate code

Say you’re latest to Python, but you have already got experience with one other programming language. You should utilize ChatGPT to translate existing code written in your favorite language to Python in seconds!

Listed below are a couple of ideas:

  1. For those who know the syntax to fill null data in a SQL table, you possibly can ask ChatGPT to seek out the equivalent function and translate the SQL query to pandas code.

2. If you’ve got created a function in R and need to adapt it to Python, you possibly can ask ChatGPT for help.

Again, you possibly can ask ChatGPT so as to add comments and explanations to know more concerning the translated code.

That’s it! There are more ways ChatGPT can show you how to enhance your learning when learning to code. To know more check this text I wrote.



Please enter your comment!
Please enter your name here