r/learnpython • • 18h ago

Roadmap and book recommendations for advanced Python, Data Structures, and AI?

5 Upvotes

Hi everyone,

I am looking to build a strong foundation in Python with the long-term goal of getting into Machine Learning and AI.

Right now, I want to focus on three main areas:

  1. Advanced Python concepts (writing clean, efficient, and Pythonic code)
  2. Data Structures and Algorithms (DSA) in Python
  3. Transitioning from core Python to AI/ML libraries

Could you recommend a good learning roadmap, along with the best books or free resources to start with?

Thanks in advance for your help!


r/learnpython • • 13h ago

Anyone help me with this loop? I cant break out of the outer loop?

3 Upvotes
while True:
    try:
        STickets = float(input("Please enter the amount of student tickets you would like"))
        if STickets %1 !=0:
            print("please enter a whole number!")
            continue
        elif STickets < 0:
            print("please enter a positive number!")
            continue
        else:
            print(f"You have selected {int(STickets)}")
            Answer = input("is this the correct number? Yes/No").strip().capitalize()
            while True:
                    if Answer == "No":
                        break
                    if Answer =="Yes":
                        print("Confirmed")
                        break
                    else:
                        Answer = input("Enter Yes or No: ").strip().capitalize()
                    if Answer == "Yes":
                    break

r/learnpython • • 15h ago

Variability in langdetect output

3 Upvotes

Hi all,
I’m using Python to filter out rows that contains non-English text from a noisy 10,000-row Excel dataset, and the final count varies slightly between runs (for example, keeping 7,522 vs. 7,508 cells—a difference of less than 0.001% of total cells). Is that normal for noisy data, and is that level of variance acceptable for research?

Thanks all!


r/learnpython • • 1h ago

B.Pharm student looking for help with a CNN-based project in Pharmacognosy!

2 Upvotes

Hi everyone!

I'm a final-year B.Pharm student working on my final-year project under Pharmacognosy, and I've decided to explore using Convolutional Neural Networks (CNNs) to detect adulterants in powdered crude drugs through microscopic images.

The idea is to train an image classification model that can distinguish genuine crude drugs from adulterated samples, potentially making herbal drug quality control more efficient.

Here's the catch: I'm a complete beginner when it comes to coding and machine learning!

I've tried a small experiment on Google Colab (black pepper vs. papaya seeds), but I have a LOT to learn.

I'm looking for help from:

  • IT/CS students or professionals familiar with Python, CNNs and image classification.
  • Anyone experienced with machine learning, microscopy or image datasets.
  • Pharmacy/Pharmacognosy researchers who could offer guidance on the scientific side.

I'm willing to put in the work and learn. I'm not expecting anyone to do the project for me; even a little guidance, useful resources, research papers or suggestions would mean a lot.

I have around 7 months to work on this, and I'd love to connect with anyone who might be interested in helping me navigate this journey.

Any help is genuinely appreciated. Thank you! :)


r/learnpython • • 13h ago

Function without argument

2 Upvotes

Ive got a function that takes a dictionary as an argument.
Now Id like to program it so when the function is called without any argument, instead of an error message it prints something custom (a dictionary for example).

Any help is appreciated :D