r/learnpython • • 3h ago

any tips for learning python as a first coding language when you don't know anything about coding

0 Upvotes

i know literally nothing about coding but i wanna start, how and where? (preferably not costing money) and is python the best option to learn first? i am pretty much unsure of anything about coding at all


r/learnpython • • 10h ago

How to solve python problems?

1 Upvotes

This may be a dumb questions, but I do not get how to write code. For some context, I am taking a scientific computing course in my uni, I am a physics major, so most of the coding we do pertains to some kinda physics/math related problem. I know how to do the math on its own but I don't get how to translate it into code. When I see a problem I don't even know how to start it.
For example:

Write a function my_cubic_spline_flat(x, y, X), where x and y are arrays containing experimental data points, and X is an array. Assume that x and X are in ascending order and have unique elements. The output argument, Y, should be an array, the same size as X, where Y[i] is the cubic spline interpolation of X[i]. However, instead of the constraints we introduced before, 𝑆′1(𝑥_1)=0 and 𝑆′𝑛−1(𝑥_𝑛)=0.

When I see that, I do not know what to do. Like I know how to write functions and stuff, but not the actual code that goes inside the function.

Any advice is appreciated! :)


r/learnpython • • 17h ago

Does anyone play high level sudoku?

0 Upvotes

Hi,

I'm trying to make a very advanced sudoku player in python.

However, it generates sudokus far too slowly. Can someone help me? (I'll only share source code once someone says yes)

EDIT: found solution, deleting in a week


r/learnpython • • 22h ago

Append key and value list to another value list of a different dict...

1 Upvotes

I have a problem that I need to solve, and I've been working on this for too long to care about doing it another way.

I have a dict with keys that I need to split into different sections. For example: I need keys 1-3, 4-6, 7-9 to go into section 1, 2, 3 etc, which have their own keys in another dictionary (Code below)

sectioned = {'1': {}, '2': {}, '3': {}}
unsectioned = {'key1': [value1, value2, value3], 'key2': [value1, value2, value3], 'key3': [value1, value2, value3], 'key4': [value1, value2, value3], 'key5': [value1, value2, value3], 'key6': [value1, value2, value3], 'key7': [value1, value2, value3], 'key8': [value1, value2, value3], 'key9': [value1, value2, value3]}

I want to move these to make:

sectioned = {'1': {'key1': [value1, value2, value3], 'key2': [value1, value2, value3], 'key3': [value1, value2, value3]}, '2': {'key4': [value1, value2, value3], 'key5': [value1, value2, value3], 'key6': [value1, value2, value3]}, '3': {'key7': [value1, value2, value3], 'key8': [value1, value2, value3], 'key9': [value1, value2, value3]}}

How would I do this? I've tried a few things using 'for' statements, but I can't get it quite right...


r/learnpython • • 12h ago

Relearning coding, no gen AI?

2 Upvotes

Note: I am not here to debate generative AI ethics.

I haven’t coded in a while and can’t think of a project to work on, so I was hoping for a course I could take to refresh my knowledge that would not delve into generative ai. Any suggestions? I’d really like to find something that just doesn’t talk about it at all, as I’m sick of having to set up a cognitive filter to ignore it myself.

I’m aware I could find a book written before ~2022 but I thrive under a “class learning” structure and like learning on the go.


r/learnpython • • 5h ago

Is coddy a good place to start if I'm looking forward to build a career from scratch?

0 Upvotes

I really want to get into the programming world despite the fact that I've studied else back at school,my Ultimate goal is to get hired as a programmer from here to the next year,I heard they give you a certificate upon completing the course,is it worth anything?


r/learnpython • • 11h ago

Is there any way to play audio in Python without using external libraries or winsound?

7 Upvotes

I wanted to play audio in Python, so I started looking for modules that were already installed, it means ones that wouldn't require an internet connection to install (for example Pygame)

I found winsound but the problem is that it will only play audio on Windows and no in other OS

It seemed more convenient not to have to install external libraries to test Python capabilities within the existing environment (such as using Tkinter instead of game engines)

Unfortunately many audio libraries and modules were removed in 3.13 (i'm using 3.14)


r/learnpython • • 21h ago

How do you keep a small open-source package maintained over time?

7 Upvotes

I recently published my first package on PyPI. It works and has tests and CI, but I've never maintained anything long term. For those of you with packages people actually use:

  • How to determine which features should be in a patch and which in a small release. And when to upgrade to 1.0?
  • How to ensure that your dependencies and GitHub actions are up-to-date without it becoming tedious. For example, is Dependabot or Renovate (or another tool) used?
  • Should dependencies be version locked or not?
  • How much time do you allocate to this? And how do you manage it if you are particularly busy?

All good practice and common errors are really appreciated!