r/PythonLearning • • Aug 12 '25

Why not 4th!

Post image
11 Upvotes

In the fourth argument is the string "end1 ", then why is the correct answer the 1st one
This is a Codechef practice problem


r/PythonLearning • • Jun 09 '26

Aura Farming

Thumbnail sidharth-5.github.io
0 Upvotes

Finished my Computer Science degree.

Got bored.

Built an AI that judges your aura based on your achievements.

Chat, did I cook or should I uninstall VS Code?


r/PythonLearning • • Sep 26 '25

How to prepare for a Junior API Developer (Python) interview in under a week?

2 Upvotes

I recently landed an interview for a Junior API Developer position that focuses on Python. The role description mentions 1-2 years of experience by default, but I don't have that much direct experience - l've got less than a week to prepare.

For anyone who has worked in API development or interviewed for similar roles:

What are the fundamentals I should focus on in this short time?

Which Python/API concepts are most important for a junior-level role?

Any suggestions on resources, practice projects, or common interview questions?


r/PythonLearning • • 25d ago

Most developers test what they expect their code to do.

Post image
2 Upvotes

But what about the inputs they never thought of?

That's where Hypothesis, a Python property-based testing library, gets interesting.

Instead of writing individual test cases for every possible input, you define properties your code should always satisfy.

Hypothesis then generates inputs automatically, including edge cases that are easy to overlook.

For example, if you're testing a function that sorts a list, you could verify that:

  • The output is always sorted.

  • The output contains exactly the same elements as the input.

  • Sorting an already sorted list doesn't change it.

The interesting part? When Hypothesis discovers a failing input, it tries to reduce it to a simpler example that exposes the bug.

This can be especially useful for financial calculations, data pipelines, API validation, and algorithms where unexpected inputs can cause subtle failures.

How do you test edge cases in your Python projects? Do you rely on manually written test cases, or have you tried property-based testing?


r/PythonLearning • • Jun 12 '25

Help Request is it woking?

Post image
2 Upvotes

i am new developper and i don,t know if this is working can you help me?


r/PythonLearning • • Apr 09 '25

Python learning warning tale.(i need to lock in frfr😭)

0 Upvotes

I. Just. Bombed. My. Python. Test. I was not prepared😭. Honestly, this is just a warning tale for those learning python to not slack on studying up before a test cuz the sheer panic you feel when SOMETHINGs wrong but you dont know what is crayyyy. I was trying to figure that thing out on the spot, not bc i didnt study at all!!! I did, just the thing is i got unlucky as hell and got all the questions abt 1 of the sub.thingies that i just skimmed. I was like, change small thing, run simulation, over and over again😭 ill prob get points cuz i did know the basics of how its supposed to work but still.


r/PythonLearning • • Aug 01 '25

Just learned python

2 Upvotes

I see a lot of my friends do trading in metatrader5 and i kind of inspired to make an ai trader that automaticly execute trades but theres a problem where the robot cant learn and i got an idea to integrate the metatrader5 script with onnx machine learning and neural networking and now how can i integrate them? Or any alternative? Because i had this problem for a week and cant figure out how to integrate them


r/PythonLearning • • May 22 '26

How to run Python projects with zero global installations: A guide to clean environments

0 Upvotes

If you've tried to run open-source AI/ML/CV repos from GitHub, you've probably hit this loop:

  1. Clone the repo.

  2. Run pip install -r requirements.txt or poetry install.

  3. Get C/C++ build errors, missing CUDA bits, or linker failures (like libgomp.so.1 not found).

  4. Spend hours debugging drivers, PATH, and toolchains.

This is exactly what unified (Python + native) package managers fix: you can clone a repo, run one install command, and get the exact same environment.

This isn't just "dependency hell." In AI and scientific computing, we have a chronic environment reproducibility problem. Many projects aren't reproducible out-of-the-box because the real dependency graph isn't only Python-it's Python + native libraries + GPU constraints.


Why the "manual machine" approach fails

A common pattern is piling global runtimes and toolchains onto one laptop. I once worked with a lead dev who had Python 3.8 through 3.13 manually installed globally.

That causes predictable pain:

  • System pollution: Multiple global installs compete for PATH priority and can break system-level scripts.

  • Duplicate installations: While pip is smart enough to share a global download cache, each virtualenv still installs its own heavy packages into its own site-packages directory, consuming gigabytes of space across projects.

  • Hidden dependencies: If your project relies on a system library you installed long ago (via Homebrew, apt, or a Windows installer), it "works for you" but fails for everyone else.

Even if you use pyenv + venv carefully, Python-only tooling still can't reliably capture the non-Python parts: C/C++/Rust/Fortran dependencies, OpenMP/BLAS, and GPU constraints. When pre-compiled wheels aren't available for your platform/Python/GPU combination, installs fall back to local compilation-and that's when things explode.

This is the gap that unified binary managers are designed to close.


The shift: Manage Python and native dependencies together

For true environment reproducibility, you need a single tool that can manage:

  1. Python packages (NumPy, PyTorch, etc.)

  2. Native binaries + libraries (compilers, CMake, system libraries) in an isolated user space

This is where the Conda-style ecosystem-and modern tools like Pixi-help. With Pixi, you don't even need a global Python install; Python is treated as just another dependency in the environment.

To see how clean this approach keeps your system, consider the basic workspace setup.


The basic workflow (no global Python needed)

1) Create a project

pixi init my-ai-project
cd my-ai-project

2) Add dependencies (including Python)

pixi add python=3.12 numpy

3) Install and run

pixi install
pixi run python main.py

For most AI and ML work, however, you will eventually hit a harder constraint: GPU runtimes.


CUDA reality check (what's actually possible)

No environment manager can fully package your GPU driver. CUDA ultimately depends on a compatible NVIDIA kernel driver installed on the host OS.

What a unified manager can do is make everything around that boundary cleaner: you declare your host's CUDA compatibility and let the solver choose matching packages.

Example pixi.toml configuration:

[system-requirements]
cuda = "12"  # Host driver is compatible with CUDA 12-era packages

Then you can install build tools and target CUDA-enabled builds directly (note: exact packages and channels can vary by platform):

pixi add cmake "pytorch=*=cuda*"

Why this matters beyond day-one setup

A package manager isn't just an installer-it is a lifecycle coordinator:

  • Before (Setup): It resolves cross-platform constraints and produces a deterministic lockfile (pixi.lock).

  • During (Development): You can safely add dependencies and roll back if an upgrade breaks things.

  • After (Maintenance & Sharing): Pixi installs packages via hard links (or reflinks on supported filesystems). Multiple local projects share the same underlying package files on disk, saving gigabytes of space. Most importantly, others can recreate your exact environment from the lockfile instead of debugging their OS.


Conclusion

If we want "clone and run" to be the standard in AI development, we need to treat the environment as part of the project itself-not as an exercise we leave to the end-user. By shifting the paradigm toward unified package management, we can spend less time configuring CUDA paths and more time actually building models.


TL;DR & Discussion

TL;DR: Many AI and data science projects break because they need native computer files and compilers that standard Python installations don't include. By using a modern, unified package manager, you can install both Python and your project libraries in one isolated folder, keeping your computer completely clean of global installations.

For discussion: As you build and share your first Python projects, how do you handle sharing them so that other people can run them without errors? Have you ever run into a situation where your code ran fine on your machine but broke the moment a classmate or friend tried to run it on theirs?


r/PythonLearning • • Jul 28 '26

Which underrated Python library do you wish more developers knew about?

2 Upvotes

r/PythonLearning • • Jul 30 '26

Welcome everyone, I'm very interested in where to start learning Python. I'd be wondering where to start studying it, and what materials on the Internet (and not so much) will help me. Thank you all in advance

0 Upvotes

r/PythonLearning • • Nov 08 '25

Why just print one dict

Post image
0 Upvotes

r/PythonLearning • • Mar 16 '26

Learning python and confused about a book question

2 Upvotes

I'm in a college course the question is

my code temperature = 0

temperature = int(input('a the temperature between 78 and 100.'))

while temperature < 78 or temperature > 100:

temperature = int(input('a the temperature between 78 and 100.'))

print('Temperature accepted.'):

asignment: Write a program that prompts the user for a temperature and validates that the user input is within the range of 78 to 100 (inclusive). Here are the requirements:

  • If the user enters a value that is outside of this range, the program should prompt the user for the temperature again.

  • The program should continue prompting the user until they enter a value within the range.

  • Once the user enters a valid temperature, the program should display "Temperature accepted."

Below is a sample run in which the user first enters 64 and 102, both of which are outside the acceptable range. Then the user enters 78 which is accepted. Make sure your program's prompts and messages match those shown in the sample run.

Sample Run with User Input Shown in <>

Enter the temperature: <64>
Enter the temperature: <102>
Enter the temperature: <78>
Temperature accepted.

My code is:

temperature = 0

temperature = int(input('a the temperature between 78 and 100.'))

while temperature < 78 or temperature > 100:

temperature = int(input('a the temperature between 78 and 100.'))

print('Temperature accepted.')

when I try and submit that code I get this error from the book:

Expected the output to be 4 lines long, instead got 1.

Any thoughts?


r/PythonLearning • • Jun 20 '26

Most efficient way to clear this exact "No-AI, No-Framework" Python Foundation? Need specific video & practice recs.

0 Upvotes

Hey everyone,

I’m looking to map out the most streamlined, high-efficiency path to master the core foundations of Python. My strict rule for this initial phase is no AI code generation tools (like ChatGPT/Cursor/Copilot writing the code for me) and no high-level frameworks (no Django, FastAPI, etc.). I want to build genuine muscle memory and deeply understand how the language executes under the hood before taking shortcuts.

Here is the exact syllabus I need to conquer for Phase I — Python Foundation:

  • Module 1 — Python Core: Data types, variables, control flow (loops/conditionals), functions, error handling (try/except), and file I/O.

  • Module 2 — Python Data Structures & Real Files: Lists, dicts, sets, comprehensions, using the native csv and json modules, and executing basic tabular transformations.

  • Module 3 — Python Working Code: Passing functions as arguments, modules/imports, environment management (venv or uv), package installations, .env file parsing, and clean project structuring.

My Goal: I want to find the absolute fastest, most practical manner to complete this phase completely without getting trapped in tutorial hell.

For those who have self-studied or taught this successfully:

  1. Which specific videos or structured lecture series map to these modules cleanly with zero fluff? (If there's a specific creator, standalone deep-dive, or course playlist that scales up to Module 2/3 topics well, please drop the name/link).

  2. Which specific resources should I use to train? I'm looking for deliberate practice platforms, labs, or micro-challenges that force me to build things like file parsers and data mapping logic rather than just abstract math riddles.

Appearing to avoid any generic advice like "just build a project"—I'm trying to find the most optimized, step-by-step training pipeline for these exact pieces. Thanks!


r/PythonLearning • • Jun 24 '26

How much OOP's I know ??

2 Upvotes

Hello, I am a 16-year-old passionate about programming and building things. I was learning Python and I genuinely loved it. When I moved on to OOP concepts, I got frustrated and overwhelmed, but I somehow managed to get through it. Now OOP feels very easy for me, and I want you guys to rate my program that I wrote in OOP.

Note: I wrote this code 6 months ago.

Bank Management System (OOP Python Project)


r/PythonLearning • • Jul 28 '26

It's a FastAPI starter with SQLAlchemy, Alembic, and auth support, with Docker coming next.

Thumbnail
gallery
2 Upvotes

r/PythonLearning • • 9d ago

Python Quiz of the day!

0 Upvotes

What will be the output of the following Python Code?

print((lambda x: (lambda y: x**y)(3))(2))


r/PythonLearning • • Jun 10 '26

I don't know how to start

2 Upvotes

I've learnt python not completely, and I want to develop myself.

I think I've fallen into the tutorial hell and idfk how to get out. Like is there a specific project so I can make and can be very beneficial? Ik I'm a dumb but I need some help please


r/PythonLearning • • 26d ago

Showcase I built Athena to catch breaking changes in Git PRs

Post image
0 Upvotes

I've been working on Athena, an open-source tool that analyzes Git diffs and ASTs to detect potential breaking changes before they get merged.

For v1.1.0, I tested it against 55 popular repositories and found some interesting issues:

• Fixed a C++ performance problem that reduced analysis time from 371 seconds to 7.33 seconds.

• Reduced false positives from 78 alerts to 8.

• Fixed Ruby symbol detection and PHP recursion detection.

The final benchmark covered 55 repositories and 10,680 diff hunks with 121 tests passing.

I'm also experimenting with local models through Ollama to generate summaries without replacing the deterministic analysis.

I'd appreciate it if anyone here gave the project a look and shared feedback. I'm especially interested in false positives, edge cases in Python AST analysis and approaches to detecting breaking API changes

⭐ If you find the project useful, consider giving it a star on GitHub. It would really help the project reach more developers

GitHub: https://github.com/aaryanrwt/athena

Release notes: https://github.com/aaryanrwt/athena/releases/tag/v1.1.0⁠


r/PythonLearning • • Feb 04 '25

Why every python codes not works?

2 Upvotes

I tried everything, from complex - simple hello world python codes, and It's just not works. Always shows the same error message. What's the fault here? I tried to research, used chatgpt to solve the problem but still showing this.


r/PythonLearning • • Jan 06 '25

Why I couldn’t import from telegram?

Thumbnail
gallery
2 Upvotes

r/PythonLearning • • Oct 24 '24

Why does it say not not defined

Thumbnail
gallery
0 Upvotes

r/PythonLearning • • Aug 15 '24

Problem kya h bta do

Post image
2 Upvotes

I have wrote python code for the question Search for a no. a in this tuple using loop:- (1,4,9,16,25,36,49,64,81,100) Prr isme iske aage run nhi krr rha h kyuuu bta do


r/PythonLearning • • Aug 08 '25

New to coding

2 Upvotes

I just picked up a cheap old MacBook from 2012 and wondering a few things

A. Can I use it to learn to code B. Where or what do I use to learn


r/PythonLearning • • Apr 24 '26

envsniff – Detect undocumented env vars before they break prod

Post image
0 Upvotes

I built envsniff because every team I've been on has the same bug class:

someone adds process.env.STRIPE_KEY or os.environ.get("DB_HOST"), it works on their

machine, passes code review, and then the next dev who clones the repo gets a

cryptic KeyError because .env.example was never updated.