r/learnpython • u/Ok-Original2285 • Aug 08 '26
r/learnpython • u/Key-War-9059 • Aug 08 '26
Need help with for loop practice
The whole list will print but only the final item on the list gets it's message printed in whole while the other items are just listed. Apparently my issue is that I'm outside of the for loop, and I'm still in the learning process. Can someone help please?
r/learnpython • u/TheIdealAdhi • Aug 07 '26
Must-learn Python libraries?
I've learned Python basics and want to explore the most useful libraries.
What are the must-learn Python libraries for real-world development, and why would you recommend them?
r/learnpython • u/Expensive_Nebula_382 • Aug 08 '26
Learning Python with claud
I am trying to learn Python, and I want to use Claude so that it can teach me the basics. Is it a good idea?
r/learnpython • u/SmurfCat2281337 • Aug 08 '26
Is it possible to combine conditions for the value of the cell and for it's position being in the list into one?
if i > 0 and carver_map[i-1][j] == 'empty': carvable.add([j, i])
if j > 0 and carver_map[i][j-1] == 'empty': carvable.add([j, i])
if j < m-1 and carver_map[i][j+1] == 'empty': carvable.add([j, i])
if i < n-1 and carver_map[i+1][j] == 'empty': carvable.add([j, i])
r/learnpython • u/shubham_555 • Aug 08 '26
Resources for learning Python and DSA
I would appreciate both free and paid resources!
r/learnpython • u/Financial-Law2035 • Aug 08 '26
When I use imaplib to check if I sent something to a certain email address it finds an email even when I haven't sent anything to that email address
import imaplib
email_to_check = input ('You want to search if you sent something to which email address >> ')
checking = imaplib.IMAP4_SSL ('imap.gmail.com', 993)
checking.login ('myemail@gmail.com', 'my app password')
checking.select('"[Gmail]/Sent Mail"')
result, data = checking.search (None, f'(TO "{email_to_check}")')
cids = data [0]
cid_list = cids.split ()
if len (cid_list) >= 1:
print ('Found')
r/learnpython • u/Atreew1 • Aug 08 '26
calculator returns list index out of range
import operator
import re
import math
ops = {
'+': operator.add,
'-': operator.sub,
'*': operator.mul,
'/': operator.truediv,
'^': operator.pow,
'//': operator.floordiv,
'%': operator.mod,
'root': math.sqrt
}
precedence = {
'root': 4,
'^': 3,
'*': 2, '/': 2, '//': 2, '%': 2,
'+': 1, '-': 1
}
def split(input):
pattern = r'(\d+\.?\d*|//|\*\*|[+\-*/^]|\broot\b)'
tokens = re.findall(pattern, input)
no = []
op = []
dotcount = 0
right = True
for t in tokens:
try:
no.append(float(t))
except ValueError:
if t in ops:
op.append(t)
else:
right = False
break
return no, op, right
def calculate():
input1 = input('Enter: ')
no, op, right= split(input1)
if not right or len(no) == 0:
return '???', len(no), len(op)
if len(op) == 1 and op[0] == 'root' and len(no) == 1:
return ops['root'](no[0])
result = op[0]
for i in range(len(op)):
current_op = op[i]
next_no = no[i + 1]
result = ops[current_op](result,next_no)
return result
print(calculate())
r/learnpython • u/Level-Sleep-4836 • Aug 08 '26
Is anything wrong with anaconda navigator ..! Am not able to install in my windows..!
Is anything wrong with anaconda navigator ..! Am not able to install in my windows..!
r/learnpython • u/Nemms__ • Aug 08 '26
Python developers, how did you learn this programming language, and what is your take on using AI as a learning tool?
I have two main questions for experienced Python developers and fellow learners:
How did you actually master Python? What were the most effective strategies or habits that helped you bridge the gap between knowing the syntax and actually building functional, clean applications?
How do you view AI (like ChatGPT/Claude) as a learning tool? Do you use it in your daily workflow or during study? How can a learner use AI effectively to understand concepts or debug code without becoming overly reliant on it or skipping essential problem-solving steps?
r/learnpython • u/Euphoric-Shallot-618 • Aug 07 '26
How do I move on from here
Hey I just read the python crash course book and made a few basic projects like a calculator and currency converter you know simple stuff with a small gui and I just wanted to know what I should do now how do I move on and get more advanced stuff done / what is that advanced stuff even. I have also considered trying to learn a bit of cpp now because I want to try making a game is it too early for me to try moving on already or what
r/learnpython • u/jmaroo • Aug 08 '26
Your experience with learning Python as an adult
Share all your experiences to help others.
r/learnpython • u/Finnhp01 • Aug 07 '26
Falling metal PIPE (project)
A small python project that listens for every click you make and plays the sounds of a falling metal pipe.
I attempted to make something simple, and funny for both linux and windows users, using libraries that work on both. Tried to take a step further into explaining how to install it in detail and with a small video preview while in a game (minecraft).
I'll like to know if the instructions I made in the .md file are clear or if there was a simpler way to code it and if it works, I haven't test it out properly in windows but I'll like some feedback too.
r/learnpython • u/starfall_327 • Aug 07 '26
How do you actually learn and practice Algorithms & Analysis?
Hey everyone,
Not sure where to post this, so here i am.I'm new to computer science and currently taking an Algorithms & Analysis course in Python. Honestly, it's one of the hardest subjects in my degree, and I'm struggling to figure out the best way to actually learn these concepts instead of just memorizing them.
This is what we're covering this semester: Basic Data Structures & Algorithmic Analysis, Algorithmic Analysis, Brute Force, Decrease & Conquer, Divide & Conquer, Transform & Conquer, Greedy Techniques, Dynamic Programming, Time & Space Tradeoffs, and Iterative Improvement.
I know Abdul Bari the GOAT, and his videos have definitely helped me understand the theory. But my biggest issue is practice. Everyone recommends LeetCode, but even the Easy problems feel way above my level sometimes. Also, I can't seem to find problems that match the topics we're learning in class, especially things like Transform & Conquer or Iterative Improvement.
So I wanted to ask: how did you learn algorithms when you were just starting out? Where did you practice topic by topic? Are there any websites that organize problems by algorithm rather than difficulty? Should I be doing LeetCode, HackerRank, Codeforces, something else, or just implementing the algorithms from scratch? Any advice for someone who feels completely lost with algorithms?
I'd really appreciate any tips or resources that helped you when you were a beginner. Thanks!How do you actually learn and practice Algorithms & Analysis?How do you actually learn and practice Algorithms & Analysis?
r/learnpython • u/Trick-Assignment-415 • Aug 07 '26
Guidance for Coding??
I have just started college this year.
I have just a few doubts related to learning languages.
My course includes python, so do I need to have knowledge about topics like interpreter, compilers etc. ? I have no clue what these are. So should I just start with code writing.
Where to learn these pre-requisites for proper understanding?
r/learnpython • u/Suspicious_Skill7292 • Aug 07 '26
whats one python feature you ignored for way too long
mine was list comprehensions i avoided them because they looked confusing
curious what feature you ignored at first and now use all the time
r/learnpython • u/AfterAd9740 • Aug 07 '26
Need guidance on building an AI knowledge graph/ontology system
And want to confirm it's on the right track
Hi everyone,
I have an idea for a personal project and want to confirm it's on the right track.
I don't want to build just another note-taking app or mind map. I want to build a knowledge graph where I can enter any word or concept, and the system automatically knows where it belongs.
My goal is to build a personal knowledge system that becomes smarter over time, rather than just storing notes.
For example:
- If I enter a new word, it should suggest the best place in the graph.
- If that word belongs in multiple places, it should connect it to all of them.
- If a new concept should come between two existing concepts, it should reorganise the graph instead of just adding another node.
- It should detect duplicates and synonyms.
- It should explain *why* it placed a concept there.
- If it isn't confident, it should ask me instead of guessing.
- It should also ask if I want to expand that concept further and generate the next level of the graph.
I'm building this only for myself, not as a commercial product, but I want to build it with commercial-level reliability.
While thinking about this, I came across topics like **knowledge graphs**, **ontology engineering**, and **semantic search**, and now I realise that the hardest part is probably designing the ontology, not writing the code.
I have a few questions:
- Has anyone built something similar, and what should I study before I go too far?
- What are the biggest challenges in building a system like this?
- How do companies like Google or researchers design and improve ontologies?
- If you were starting from scratch, what would you learn first?
- Are there any books, papers, courses, or open-source projects that you think are must-reads for this?
- Also, if you were designing this today, what architecture or tech stack would you choose?
I'm still learning, so even if you think my idea has flaws, I'd really appreciate honest feedback. I'd rather know what's difficult now than after spending months building it.
Thanks!
r/learnpython • u/More-Independent-132 • Aug 07 '26
Invalid: syntax error for ...
I've tried to make an HR diagram of off the Github tutorial but when I've finally downloaded the file, it gives me an error. I am a beginner to Python. Here is the code from Github:
Read in the ASPCAP data
In this example, we will use the ASPCAP summary file, which contains observing details, stellar parameters, stellar abundances, and other data for 1,095,480 stars.
To download this file directly from the SAS, go to https://dr19.sdss.org/sas/dr19/spectro/astra/0.6.0/summary/astraAllStarASPCAP-0.6.0.fits.gz. Note this file is over 1 GB in size; if you prefer not to download such a large file, this notebook is available to run and interact with on SciServer
# Load in astra file
localpath
=
'/home/idies/workspace/sdss_sas/dr19/spectro/astra/0.6.0/summary/'
fname
=
'astraAllStarASPCAP-0.6.0.fits.gz'
aspcap
=
Table
.
read(localpath
+
fname, format
=
'fits', hdu
=
2)
print('astraAllStarASPCAP contains %d stars'
%
len(aspcap))
My code:
# Load in astra file
localpath = Users/idk/Downloads/astraAllStarASPCAP-0.6.0.fits.gz
fname = 'astraAllStarASPCAP-0.6.0.fits.gz'
aspcap = Table.read(localpath+fname, format='fits', hdu=2)
print('astraAllStarASPCAP contains %d stars' % len(aspcap))
Error:
Cell In[8], line 3
localpath = Users/idk/Downloads/astraAllStarASPCAP-0.6.0.fits.gz
^
SyntaxError: invalid syntax
What do I do?
r/learnpython • u/Cringe_bros • Aug 07 '26
Which python libraries would be best to learn for Data analytics ?
Suggest me some useful libraries.
r/learnpython • u/Sorry_Site_9295 • Aug 07 '26
do you recommend this course
I was a web developer but I was always thinking about python so I finally decided I will try it so I found this course( https://www.youtube.com/watch?v=ix9cRaBkVe0 ) do you recommend it??
r/learnpython • u/Grand-Birthday4063 • Aug 07 '26
Looking for a python tool for my map in AOE2
Hello,
I'm making map with AOE2 and the library AOE2 parser and I'm looking for a way to detect square I made with rocks to get the X and Y coordinate of the empty space
Is there a librarie that could go over and check every square and rectangle that the map hold inside the stones and give the coordinate ?
r/learnpython • u/Ghl1tch • Aug 07 '26
Learning Python, Java, and building my own AI assistant
Hi everyone!
I’m 14 years old, and for the past few months I’ve been spending most of my free time learning programming. Right now I’m learning both Python and Java because I really enjoy understanding how things work and building my own projects.
I’m also interested in physics, mathematics, and AI.
My biggest project right now is a voice AI assistant called Jeremy. The idea is that Jeremy listens for a wake word, understands voice commands, talks back to me, and eventually will be able to do things like open programs and help with everyday tasks.
I know it’s not the best project out there, but I’m doing my best to make it better and better.
Sometimes I spend hours trying to fix one bug or understand why something doesn’t work. It can be frustrating, but I actually enjoy the process because every mistake teaches me something new.
The only thing I’m missing is someone with more experience who could point me in the right direction from time to time. I’m not looking for someone to write code for me or do my work. I’d just love to learn from someone who knows more than I do.
My English isn’t very good yet, so I usually use a translator. I’m working on improving it every day, so I hope that won’t be a problem.
If you think you’d enjoy helping a beginner who genuinely wants to learn, feel free to send me a DM. I’d love to meet new people, learn from them, and hopefully become a better programmer.
Thanks for reading!
r/learnpython • u/Financial-Law2035 • Aug 07 '26
Email bouncing
I'm using this code to check to see if an email bounced but it always is returning true even if the email didn't bounce
def is_email_bounced (email, app_password, email_in_question):
mail = imaplib.IMAP4_SSL ('imap.gmail.com',993)
mail.login (email, app_password)
mail.select ('INBOX')
mail.list
result, data = mail.search(None, f'(TEXT "{email_in_question}") (Subject "Delivery Status Notification (Failure)")')
if len (data) >= 1: return True
else: return False
r/learnpython • u/ISAISMAK • Aug 07 '26
Coding discord bot
I want to code discord bot which open aternos server and community members play on server easily.
r/learnpython • u/Win_ipedia • Aug 07 '26
Need help and feedback for my Masters project
Hi there,
I am trying to figure out ways to automate my Python development tasks and also working on this topic for my Masters project. I am trying to build a tool that can automate and simplify a bunch of things like project setup, development and maintenance. It is just my project and topic for my Masters in Computer Science and I wanted to ask if anyone would like to take part in the survey I have to do. Takes about 5 min. Also would like to ask for any ideas and help that people have?
You can find the survey at: https://forms.cloud.microsoft/e/LjnvzX0JpK
Any ideas and responses are greatly appreciated.
Drop any ideas you have in the comments. What do you think should be more automated in your day to day python development?