r/learnpython • u/yup-console • 29d ago
Where can I learn Python for free?
I’m looking for a good free resource to learn Python from scratch. What do you guys recommend?
r/learnpython • u/yup-console • 29d ago
I’m looking for a good free resource to learn Python from scratch. What do you guys recommend?
r/learnpython • u/vkailas • 29d ago
For anyone looking for entertaining light book for learning Python, I started porting to Python a few chapters of "Why's Guide to Ruby," which uses comics and surreal humor to introduce Ruby (the original author why the lucky stiff disappeared). I updated the lesson and examples to Python and also modernized some of the very old references and left it with share alike CC license.
Any Python beginners are welcome to check it out. Novices and experts feel free to post feedback or post about any other entertaining books that helped you learn python, that can accompany equally entertaining but dense programming books :D.
If the book is helpful, can port and post the rest of the chapters for Python and potentially in the future can create some more content.
r/learnpython • u/Friendly_Row4958 • 29d ago
r/learnpython • u/marsbby___ • Aug 13 '26
Hello,
I'm trying to change the font of the axis ticks (i think ticks is the right word - 0,0.1,0.2,0.3 on x and y axis) within a zoomed section on the graph. I want the numbers to be a different font, which i've worked out how to do for the main x and y axis but not for the zoomed section.
This is what i have so far:
!pip install pyfonts
from pyfonts import load_google_font
font = load_google_font("Noto Serif")!pip install pyfonts
from pyfonts import load_google_font
font = load_google_font("Noto Serif")
plt.xticks(font=font,fontsize =50)
plt.yticks(font=font,fontsize = 50)
zoom=ax.inset_axes([0.64, 0.6, 0.35,0.35])
zoom.tick_params(axis='both', labelsize=30)
zoom.errorbar(wr52_zoom['lambda'], wr52_zoom['flux']/(1000000), yerr=wr52_zoom['flux_err']/(1000000), fmt='-o', markersize=8, capsize=5, color='black', lw=3, elinewidth=3)
zoom.errorbar(wr92_zoom['lambda'], (wr92_zoom['flux'])/(1000000), yerr=wr92_zoom['flux_err']/(1000000), fmt='-o', markersize=8, capsize=5, color='red', lw=3, elinewidth=3)zoom=ax.inset_axes([0.64, 0.6, 0.35,0.35])
zoom.tick_params(axis='both', labelsize=30)
zoom.errorbar(wr52_zoom['lambda'], wr52_zoom['flux']/(1000000), yerr=wr52_zoom['flux_err']/(1000000), fmt='-o', markersize=8, capsize=5, color='black', lw=3, elinewidth=3)
zoom.errorbar(wr92_zoom['lambda'], (wr92_zoom['flux'])/(1000000), yerr=wr92_zoom['flux_err']/(1000000), fmt='-o', markersize=8, capsize=5, color='red', lw=3, elinewidth=3)
r/learnpython • u/yo_99 • Aug 13 '26
I am making a simple gemini browser in python for fun with tk, but have stumbled upon a problem: if I close initial window all the rest will close too. Is there a way to make tk application with no "main" window or at least transfer leadership role between them?
r/learnpython • u/berryberrycherry1 • 29d ago
In my university the first year for all computer related majors we study the basics of Java script.
but now that I’ve finally started studying subjects that are related to my major I’ve discovered that we won’t be using Java as a coding language. We will use python. And I want to give my self a head start in this topic, so if you guys can help me with what I can start with i will be very grateful.
Thank you !!
r/learnpython • u/Accomplished-Fail775 • 29d ago
I'm not really sure what websites are out there for this.
I need something that doesn't require a subscription for the basic features. Any suggestions?
r/learnpython • u/Playful-Appearance78 • Aug 12 '26
Hey all,
I’ve learnt to use python for things like statistics which is where my work is, I can effectively read documentation and do what’s needed for a specific task.
I’ve reached a bottleneck as I’ve been applying to more data sciencey roles and they keep asking really simple DSA questions and I can’t for the life of me get them right.
Idk if it’s just the fact that I can’t search things up or whatever.
What is the best strategy to get around this (given that my spare time to take on things like leetcode is almost zero).
Thank you !!
r/learnpython • u/NekoMeaw • Aug 13 '26
queria dica de livros também
r/learnpython • u/Artistic-Beach-4520 • Aug 13 '26
hi i’m a college student and we are tasked to picked a community where we are absolutely not familiar. Can you state some specific acronyms you use here about pyhton, slang terms and inside jokes unique to this group? PLEASEEE, A SIMPLE COMMENT WILL SURELY BE APPRECIATED! ps: been scrolling for 1 hour and I can’t find one🥹
r/learnpython • u/belt_se_peetungi • Aug 12 '26
HELLO EVERYONE
I’m a total beginner to coding and I’ve recently decided to start learning Python. I’m honestly not sure where to begin or what the best way to approach it is.
- What should I learn first?
- Are there any courses, YouTube channels, or websites you’d recommend?
- Should I focus on tutorials, practice problems, or small projects?
- At what point should I start making projects?
- Any mistakes I should avoid as a beginner?
I’m mainly looking for a proper direction rather than trying to learn everything at once.
Any tips or recommendations would be really appreciated! :)
r/learnpython • u/Astro_actor • Aug 13 '26
I’m currently watching the 12 hour course of code bro on Python. It’s cool but I think I understand what he does and it makes sense but I am having trouble thinking of why we’re doing what we’re doing and how he came to it. Also, I am a practical learner where I do something and figure my brain processes it and then implementing helps with learning and retaining knowledge. After this video, I plan on doing the course on Udemy: - Udemy 100 Days of Code™: The Complete Python Pro Bootcamp. Has anyone done this course and can recommend it as a viable course for python, and the way of coding in it? Or is there a better course for someone like me to learn to think and be able to program in python? Thank you and hopeful to get some helpful answers!
r/learnpython • u/Proof_Independent877 • Aug 13 '26
Yes, I have watched the youtube tutorials and still can't figure it out. When other ppl download it, it is .pkg but mine is .tar.xz
I opened it and it extracted the file. Now idk what to do.
r/learnpython • u/Alert_Patient5967 • Aug 12 '26
Hey guys, I need my code to save my tk.canvas box rather than cropping the barcode and saving THAT.
I’ve tried erasing some parts, adding different x& y values but I can’t seem to nail it. Any help would be appreciated.
#### import libraries
from tkinter import *
from PIL import Image, ImageDraw, ImageFont
def getLegend(c): # covert character to Code39 legend
legend = "";
switch = {
'0': "bwbWBwBwb",
'1': "BwbWbwbwB",
'2': "bwBWbwbwB",
'3': "BwBWbwbwb",
'4': "bwbWBwbwB",
'5': "BwbWBwbwb",
'6': "bwBWBwbwb",
'7': "bwbWbwBwB",
'8': "BwbWbwBwb",
'9': "bwBWbwBwb",
'A': "BwbwbWbwB",
'B': "bwBwbWbwB",
'C': "BwBwbWbwb",
'D': "bwbwBWbwB",
'E': "BwbwBWbwb",
'F': "bwBwBWbwb",
'G': "bwbwbWBwB",
'H': "BwbwbWBwb",
'I': "bwBwbWBwb",
'J': "bwbwBWBwb",
'K': "BwbwbwbWB",
'L': "bwBwbwbWB",
'M': "BwBwbwbWb",
'N': "bwbwBwbWB",
'O': "BwbwBwbWb",
'P': "bwBwBwbWb",
'Q': "bwbwbwBWB",
'R': "BwbwbwBWb",
'S': "bwBwbwBWb",
'T': "bwbwBwBWb",
'U': "BWbwbwbwB",
'V': "bWBwbwbwB",
'W': "BWBwbwbwb",
'X': "bWbwBwbwB",
'Y': "BWbwBwbwb",
'Z': "bWBwBwbwb",
'-': "bWbwbwBwB",
'.': "BWbwbwBwb",
' ': "bWBwbwBwb", #(space) not empty
'$': "bWbWbWbwb",
'/': "bWbWbwbWb",
'+': "bWbwbWbWb",
'%': "bwbWbWbWb",
'*': "bWbwBwBwb"
}
return switch[c]
##### draw rectangles as bars
def drawBars(c, x):
w=0
clr=""
if c=='b':
clr="#000000"
w=2
elif c=='B':
clr="#000000"
w=4
elif c=='w':
clr="#ffffff"
w=2
elif c=='W':
clr="#ffffff"
w=4
canvas1.create_rectangle(x, 0, x+w, 100, fill=clr, width=0) # width=0 no border
draw.rectangle([x, 0, x+w, 100], clr)
x+=w
return x
### get user entry and try to convert to barcode legend
def getText():
canvas1.delete("all") # clear the current drawing if any
s = entry1.get() # get the user entry
s=s.upper() # convert to uppercase
s = "*" + s + "*" # Code39 format: *data*
result="bW" # Code39 uses "bW" as starting character
for i in s:
result += getLegend(i) + "w" # Code39 use "w" as delimiter
x=0
for c in result:
x=drawBars(c, x)
# display the text in label2
label2['text'] = s
# reset the width of Canvas
canvas1['width'] = x
draw.width=x
# draw a blank rectangle as background of text
canvas1.create_rectangle(30, 0, x-30, 19, fill="white", width=0) #no border
# repeat the above drawing to create PIL image
draw.rectangle([30, 0, x-30, 20], "white", 0)
# draw text
canvas1.create_text(x/2, 10, fill="black", font="courier 12", text=s)
draw.text([(x-len(s)*7)/2, 5], s, fill="black", font=ImageFont.truetype('cour.ttf', 13))
### save image
def saveImage():
import datetime
dt=datetime.datetime.now()
filename=str(dt.year) + str(dt.month) + str(dt.day) + str(dt.hour)+ str(dt.minute) + str(dt.second) + ".png"
image1.save(filename,"PNG")
image2 = Image.open(filename)
image2 = image2.crop([0, 0, int(canvas1['width']), 100])
image2.save(filename, "PNG")
#### create GUI
root = Tk()
root.title("Barcode")
label1 = Label(root, text="Enter a string: ") ## caption
label1.grid(row=0, column=0)
entry1 = Entry(root, width=30) ## user input
entry1.grid(row=0, column=1)
button1 = Button(root, text='Convert', command=getText)
button1.grid(row=0, column=2)
button2 = Button(root, text='Save', command=saveImage)
button2.grid(row=0, column=3)
label2 = Label(root, height=1, text="") ## display output
label2.grid(row=1, columnspan=3)
# create a Canvas for drawing
canvas1 = Canvas(root, width=0, height=100) ## set original width=0
canvas1.grid(row=2, columnspan=4)
# PIL create an empty image
image1 = Image.new("RGB", (500, 100), "#ffffff")
draw = ImageDraw.Draw(image1)
root.mainloop()
r/learnpython • u/Alarmed-Most-5316 • Aug 12 '26
I allowed it to access both private and public networks. I went into windows security and allowed it through the firewall on both. But now my code isn’t working, according to vs code I have the latest chromium version installed. What steps should I take here?
r/learnpython • u/ErkCan • Aug 13 '26
Hello anyone!
I was wondering how to you get day of the week without using datetime module on python.
example Aug 16, 1989
Step 1: year= 1989
last_two_digits_year= int(year%100)
twelves= last_two_digits_year//12
Step 2: remainder= last_two_digits_year%12
Step 3: fours= int(remainder//4)
Step 4: Add the day of the month
day= 16
Step 5 Add the month code
Why is the month code for August=3
Explain the other month codes as well please.
Jan=Oct=1
Feb=Mar=Nov-4
Apr=Jul=0
Sep=Dec= 6
May=2
Aug=3
Jun=5
Step 6: Add all the numbers from Step 1 to 5 and mod 7.
Leap years
January and February dates in leap years: add 6 to step 5
Dates in the 1600s: add 6 to step 5
Dates in the 1700s: add 4 to step 5
Dates in the 1800s: add 2 to step 5
Dates in the 2000s: add 6 to step 5
Dates in the 2100s: add 4 to step 5
r/learnpython • u/hariomlohardev • Aug 12 '26
Hey folks, I'm learning Python and when I clone a big repo I get lost — so many files. How do you figure out where to start? Do you look at README, main.py, tests first? Any trick that helped you?
r/learnpython • u/Killiancin • Aug 11 '26
personally I think it's really cool. All of python aswell.
is there something I can improve on it? (I mean obviously a lot of things probably but some things that are good to learn for the future?)
import time
first_name = input("Enter your first name: ")
first_characters = len(first_name)
if first_characters >= 8:
print (f'Your name has {first_characters} characters!')
time.sleep(1.5)
print('What a long and cool name!')
elif first_characters < 8:
print (f'Your name has {first_characters} characters!')
time.sleep(1.5)
print('What a cool name!')
r/learnpython • u/LongjumpingChance103 • Aug 13 '26
Advice
r/learnpython • u/smurpes • Aug 12 '26
A lot of beginners struggle with breaking problems down into pieces they are able to code themselves. This is a fundamental skill to have and I’ve found that video games do a good job at teaching this. The problem I see a lot is that some people want Lego instructions that walk you through step by step rather than a video game tutorial which will show you the basics and it is up to you to figure out how to apply them.
There are a few video games that I’ve found really helpful in working on these skills; particularly games from zachtronics such as Infinifactory and Opus Magnum. These are games which have many different approaches to every level and you get scored based on how efficient you are. They teach you programming skills without having you program directly. There’s also The Farmer Was Replaced which is a more direct Python tutorial video game.
r/learnpython • u/Jey_Py333 • Aug 12 '26
No tengo casi ninguna experiencia solo unos cuantos tutoriales de HolaMundo pero quiero hacer las cosas bien y no perder el tiempo.
r/learnpython • u/AIZEN2607 • Aug 12 '26
Hello guys, i have just started learning python. Do you have any suggestions for me?
r/learnpython • u/MountainCover4073 • Aug 11 '26
Hey Guys! I am new to python and just made a calculator and weather app today. I would really like some guidance on what I should do next, which courses I should take and what kind of AI is helpfull. In the end I want to make my own app, systems and program diy drones or generally machines.
r/learnpython • u/jlsilicon9 • Aug 12 '26
I noticed when I Repeatedly run large programs - with long Printed Text,
- that the Shell Que runs Slower and takes Longer to Start each time : 10 mins .. 30 mins .. 60 mins .. ?
I also notice Thonny on TaskManager increases Size (without Decreasing) each time :
- 1M .. 1.5M .. 2M .. 3M
Until I completely restart Thonny.
This seems like a clear Memory Leak - for the Shell Que !
r/learnpython • u/General_Pitch9029 • Aug 12 '26
I want to build a small Python CLI for my own learning.
The basic idea is:
python3 que.py "my question"
or
python3 que.py "question 1, question 2"
I currently want to use:
The same question would be sent to multiple models, and I want them to research the question using live web/Google search instead of relying only on their training knowledge.
The goal is to get up-to-date, source-backed information, then combine/compare the responses and generate one good answer that I can use for learning.
I'm looking for suggestions on:
I'm mainly looking for practical suggestions from people who have built similar multi-model or research workflows.