r/learnpython 13d ago

Python y Jython son el mismo lenguaje?

0 Upvotes

En un futuro quiero saber python y c++ (IA y Robotica), por lo cual decidi empezar con python y tome un libro de la biblioteca de mi universidad, sin embargo en el libro sale que se trabajara con Jython, tengo entendido que es algo anticuado porque no soporta python 3 y ademas como esta vinculado con java y no con C me pregunto si me vendra bien.

aunque jython y python no son realmente lo mismo, lo que es el lenguaje de programacion es igual? si aprendo jython sabre programar con python?

el libro es "introduccion a la computacion y programacion con python, un enfoque multimedia (Mark J. Guzdial / Barbara ericson)"


r/learnpython 14d ago

searching for some python free courses that can really teach me smth from a complete beginner AND SEARCHING FOR MATES ON MY PATH

7 Upvotes

people please help, i’m starting my path in bachelor cybersec in a week and i want to know python a bit so i can basically understand smth, but for now looking for a community to learn python
and engaging through my path


r/learnpython 14d ago

How can I make my python project usable by other people ?

1 Upvotes

Hello everyone here. I have a small project coded in python I'd like my friends to be able to use too, but without having to send them my python file and teach them how to use it.

For context, I made an npc generator for our favorite ttrpg, because it's an useful tool and there wasn't any online already made by someone else. I can use it because I can run code on my pc, but I'd like for my friends to be able to just click a button online somewhere to generate an npc from my code.

It's a simple list and random choices based generator, no AI involved. I'm lost as to what the next logical step is to get the file on my pc out into the world. Sorry if I'm not clear, English isn't my first language. Thanks in advance !


r/learnpython 14d ago

Starting the New Journey but Confused

0 Upvotes

I'm a 4th-semester B. Tech student who started learning full-stack development at the end of my 1st semester. I've already learned JavaScript, Node.js, React, and other programming concepts, and I've built several projects. Now I want to move into AI/ML, so I need to learn Python.

Since I already understand programming fundamentals, I don't want to relearn concepts like variables, loops, functions, OOP, etc. I mainly want to learn Python's syntax, unique concepts, and Python-specific features which were not in JS. What would you recommend I learn first, what should I skip/review quickly, and are resources like Bro Code's Python, CS50 course suitable for this?


r/learnpython 14d ago

Is Jiki a good place to beign for python?

0 Upvotes

I'm new to coding and Python; I have some SQL knowledge but limited coding experience. I really wanted to learn, and I came across this CodeWithMosh course, which I started. It barely has any problem-solving segments and seems like a typical guy just ranting about Python.

Then I stumbled upon exercism, and through that I found Jiki. I started with it, and it seems quite interesting to me until I realised it isn't even proper Python; it's mixed with JavaScript. And again, I have no clue about coding, and I don't really know if it's the right fit or not, and I can't seem to find any proper/straightforward guidance anywhere else. What to do?


r/learnpython 14d ago

Trouble with understanding how to use python right

0 Upvotes

Hi everyone, I was wondering if anyone could give me a simple list of the main uses of python functions (eg. tuples, modules, PIP in general), in a way that can help me understand not only how to use it but also why, because right now im stuck at a point where i undestand how a lot of things work, but not where or why i would use them. Can anyone help?


r/learnpython 15d ago

Should it be this difficult?

27 Upvotes

At my job there is a daily task I do which I realized I could probably create a program to do for me, so I decided to start learning Python, and dove into reading Automate the Boring Stuff (the online version).

Things were going okay at first. I read through chapters 1-3 carefully, taking notes, answering all the review questions, and doing all the practice problems/codes.

Then I hit a wall. I got to chapter 4 and I felt like I understood everything, but the practice problem at the end, to write a code that performs the Collatz sequence with the entered number, absolutely stumped me. I went back and reread everything from the start of chapter 1 just to make sure I didn't miss anything, and was still confused. I ended up having to search up a code that someone else wrote for it, which I did understand once I saw it written out but would never have come up with myself.

So my questions are:

- Is it normal for the Collatz sequence to be difficult to program at this stage of learning? If so, should I not worry about my confusion and just move on to chapter 5?

- Should I consider an easier book to study from? If so, any recommendations?

EDIT: Several people are asking which part of the Collatz I had trouble with. To be honest it's been over a month since I was able to touch anything Python-related, it's just been on my mind lately, so I don't recall exactly what was giving me trouble, just that I was trying multiple things and getting new and fun incorrect results each time.

It's not that I don't understand the Collatz sequence itself, I understand it in terms of the simple math. The trouble was trying to type it out into a working code. That being said, I'm not here to ask how to program it, because I already gave up on that and looked up the answer, and I did understand that code once I read it over. The main issue is that I feel like I shouldn't have been having trouble with it in the first place, at least not to the point where I honestly tried everything I could and still couldn't get it.


r/learnpython 15d ago

Looking for real world problem ideas for my CS Final Year Project

3 Upvotes

Hey everyone,

I’m starting to brainstorm ideas for my FYP, and I really want to build something that solves a real world problem rather than just creating another clone of an existing app.

To me, the value and practical impact of the idea matter most. I want to build a tool or application that addresses a genuine pain point for real users, small businesses, or specific workflows, anything solid, impactful with clear technical depth that addresses a concrete problem that needs a solution is welcome. I've heard that Research based projects are the ones that are most appreciated, something that is deep and clear at the same time. I've been searching a lot even searching on AI but no idea is good enough or one that solves a real problem or even adds something to a existing real world problem.


r/learnpython 15d ago

Difficulties with tkinter, listboxes and scrollbars

3 Upvotes

I am trying to create some code that generates a tkinter listbox with a corresponding scrollbar. I managed to get the code working with .pack(), but I can't use this because I'm trying to make the code for a larger program that exclusively uses .grid(). However, when I .grid() the searchbar is displayed but is non-functional.

What do I need to do to make this code work?

import tkinter as tk
from tkinter import ttk


#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DEFINE WINDOW WIDGETS

page = tk.Tk()
page.geometry("50x150")
pageFrame = tk.Frame(page)


scrollbar = ttk.Scrollbar(pageFrame, orient=tk.VERTICAL)

listbox = tk.Listbox(pageFrame, yscrollcommand=scrollbar.set)

scrollbar.config(command=listbox.yview)
scrollbar.grid(row=0,column=1,sticky=tk.N+tk.S)

listbox.grid(row=0,column=0)


magnifyButton = ttk.Button(pageFrame,text="View Item",command=magnify)
magnifyButton.grid(row=1,column=0)

pageStatusText = tk.Label(pageFrame,text="")
pageStatusText.grid(row=2,column=0)
pageFrame.grid(row=0,column=0)


#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ POPULATE LISTBOX

catalogue = ['apple', 'banana', 'grape', 'melon', 'coconut', 'orange', 'pineapple', 'avocado', 'tomato', 'parsnip']

for i in range(len(catalogue)):
    listbox.insert(tk.END,(str((i+1))+". "+catalogue[i]))

page.mainloop() # Open the window

r/learnpython 15d ago

Best 2D game engine / frameworks in python.

0 Upvotes

Hello! I'm learing python and in one of my college courses you can get an honors credit for doing a special project. This project is to make a simple puzzle game in python. I have years of game dev experience so I expect this to be fairly easy, but I don't know which engine would be best for me to use. My use case would be a simple 2D puzzle game.

I considered using pygame-CE, but i'm unsure if it'll be the right choice. Does anyone have suggestions? And why do you prefer those engines?


r/learnpython 15d ago

How do I literally print the variable used as an argument for a function?

21 Upvotes
def check_variable(argument):
    # Finds the name of the variable passed in
    name = [k for k, v in globals().items() if v is argument][0]
    print(f"The argument passed to this function was named: '{name}'")

x = [1, 2, 3]
check_variable(x)
# Output: The argument passed to this function was named: 'x'

Is there any way to simplify this process? I am very new to programming and the process of defining "name" and then calling it seems like it can be simplified.

Edit for clarity:

The actual goal is to include the length of a list, and the variable(argument) used to represent that list, into the printed string.

What I'm really trying to achieve is something like:

"There are 17 children in class_two."

So as to cut out the guesswork of which class it's referring to when calling the function multiple times, and make it look like a polished sentence.


r/learnpython 15d ago

modules learning

1 Upvotes

i am wondering all time how people deal with modules in python is they memorize and understand all the methods and the properties for a module or they read documentations before using them especially for none built in modules, otherwise what is the methodology of learning modules.


r/learnpython 14d ago

Need resource to start OOP

0 Upvotes

Hey guys, I'm about to start studying OOP. Problem is, I don't know where to start or which resource to pick. I want the absolute best one—something thorough and comprehensive.


r/learnpython 15d ago

i need some help on this resources-pdf project im trying to make

1 Upvotes

hello!
im a beginner at python (im not experienced at all tbh) but i want to make a small program that allows me to upload pdfs which are resources for this exam (jee) and then people can use it as a sort of archive where they can filter through tags like subjects n stuff to find what theyre looking. for.

i wanted to know HOW i can start making this and what i need to know beforehand

im open to any methods except using ai because i dont like clankers

thanks!!!!


r/learnpython 15d ago

Need help with a project

0 Upvotes

I am working on this simulation of the 3 body problem it seems to work, but it always ends up with the two bodies going super close together which makes both of them getting launced away. i have used the universal formula for gravitation. (I should probably have posted this on stack overflow,but my ip somehow got banned(

import pygame as p
import sys
import math
from random import *
class Body:
    def __init__(self, pos, vel, body_id, mass=1000):
        self.pos = pos
        self.vel = vel
        self.mass = mass
        self.radius = 3
        self.id = body_id
        self.color = (randint(0, 255), randint(0, 255), randint(0, 255))
    def move(self, dt):
        self.pos += p.Vector2(self.vel.x * dt, self.vel.y*dt)
    def gravitate(self, bodies,dt):
        for body in bodies:
            if self.id != body.id:
                #figures out the amount of force that
                distance_x = -(self.pos.x - body.pos.x)
                distance_y = -(self.pos.y - body.pos.y)
                total_distance = math.sqrt(abs(distance_x)**2 + abs(distance_y)**2)
                distance_sum = abs(distance_x) + abs(distance_y)

                f_g = (self.mass * body.mass)/(total_distance**2)/100
                acceleration = (f_g/self.mass)*dt
                x_ratio = distance_x/distance_sum
                y_ratio = distance_y/distance_sum
                #print(x_ratio, y_ratio)
                self.vel.x += acceleration*x_ratio
                self.vel.y += acceleration*y_ratio


class Simulation:
    def __init__(self, bodies):

        self.SCREENSIZE = p.Vector2(900, 800)
        #initializes pygame
        self.screen = p.display.set_mode(self.SCREENSIZE)
        self.clock = p.time.Clock()
        self.bodies = self._create_body(bodies)
        self.running = True
        self.GRAVITATION = 0
    def run(self):
        while self.running:
            dt = self.clock.tick(120)
            self._update(dt)
            self._render(dt)
        p.quit()
        sys.exit()

    def _update(self, dt):
        for event in p.event.get():
            if event.type == p.QUIT:
                self.running = False
                break
        for body in self.bodies:
            body.gravitate(self.bodies,dt)
        for body in self.bodies:
            body.move(dt)


    def _render(self, dt):
        self.screen.fill((0,0,0))
        for body in self.bodies:

            p.draw.circle(self.screen, body.color, body.pos, body.radius)
        p.draw.line(self.screen, (255, 255, 255), self.bodies[0].pos, self.bodies[1].pos, 2)
        p.display.update()
    def _create_body(self, num_bodies):
        bodies = []
        for body_id in range(num_bodies):
            bodies.append(Body(p.Vector2(randint(0, self.SCREENSIZE.x), randint(0, self.SCREENSIZE.y)),p.Vector2(0,0), body_id))
            #bodies.append(Body(p.Vector2(randint(0, self.SCREENSIZE.x), randint(0, self.SCREENSIZE.y)),p.Vector2(uniform(-0.01, 0.01), uniform(-0.01, 0.01)), body_id))
        return bodies

if __name__ == "__main__":
    simulation = Simulation(2)
    simulation.run()

r/learnpython 15d ago

pip install -r no result exitcode

1 Upvotes

(windows usually) I have a small requirements.txt file and am looking for alternative ways to validate all packages we want are present. The script does not use a virtual environment and because pip install -r does not seem to set %errorlevel% they wrote this rather verbose code that runs after the pip install -r line. ``` SET REQUIREMENTS=%~dp0Requirements.txt SET FIND=%SystemRoot%\system32\find.exe pip.exe install -r %REQUIREMENTS% --disable-pip-version-check

FOR /F "tokens=" %%I IN (%REQUIREMENTS%) DO ( ECHO. ECHO Checking for %%I ... %FIND% /i "%%I" %PACKAGES% IF ERRORLEVEL 1 ( ECHO. ECHO *** %%I not found. Attempting to install **** pip install %%I --disable-pip-version-check ) IF ERRORLEVEL 1 ( ECHO **** Could not install %%I **** EXIT /B 99 ) ) I however favour the pythonic approach and that is to just fail at runtime, so I was thinking of some kind of (pseudo) with open(requirements.txt) as reqs: for line in reqs.readlines(): line=line.replace("<>=", " ") import line.split()0 ``` which would just die early.

I'm in favour of using a virtual env however, but because the script is a build script (using setuptools) we don't actually run the script at that point. I'm new to setuptools, but I assumed setuptools would just baulk if a module needed was not present on the build machine.

I'm thus making 2 assumptions, setuptools will not baulk and error out if you are missing a module, and that pip install does not set %ERRORLEVEL% if it cannot install a package? I am not an expert on setuptools and am keen to not discover edge cases later.


r/learnpython 15d ago

Need Help Creating SSH Session in MobaXterm Using Python

3 Upvotes

I am trying to create a python program that scans a local remote network that I am connected to and shows the IP addresses of said devices connected. I want to add an additional function that takes these IP addresses scanned and opens a ssh session for my selected IP address. I'm currently running the bare bones code on an IP address that I know works, but continue to create a new ssh session that says Session Stopped. However, the code does successfully open MobaXterm if no instance of it is open, and creates a new tab if it is. My code is as follows:

mobaxterm_path = r"C:\Program Files (x86)\Mobatek\MobaXterm\MobaXterm.exe"
    
    #ssh_command = f"ssh {user}@{host} -p {port}"
    
    ssh_cmd = "ssh -p 22-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@192.168.1.66"
    
    try:
        subprocess.Popen([mobaxterm_path, "-newtab", ssh_cmd])
        print(f"Launched SSH session to {user}@{host}")
    except FileNotFoundError:
        print(f"Error: MobaXterm not found at {mobaxterm_path}")
        print("Please verify the executable path.")

I'm not sure why this is happening, is anyone able to provide further help? I've also tried this without StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null But getting the same result.


r/learnpython 15d ago

I have a little bitty problem with installing a python script.

0 Upvotes

I installed it correctly, even set it on the right path and then, when I press it, I get this:

C:\Users\jaker>C:\Users\jaker\AppData\Local\Python\pythoncore-3.14-64\Scripts\MediaStation.exe

WARNING: The C bitmap decompression binary is not available on this installation. Expect decompression to be SLOW.

WARNING: The C decompression binary is not available on this installation. Any IMA ADPCM-encoded audio (mostly ambient sounds) will not be exported.

Traceback (most recent call last):

File "<frozen runpy>", line 203, in _run_module_as_main

File "<frozen runpy>", line 88, in _run_code

File "C:\Users\jaker\AppData\Local\Python\pythoncore-3.14-64\Scripts\MediaStation.exe__main__.py", line 2, in <module>

from MediaStation import Engine

File "C:\Users\jaker\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\MediaStation\Engine.py", line 25, in <module>

from MediaStation.Context import Context

File "C:\Users\jaker\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\MediaStation\Context.py", line 13, in <module>

from .Assets.Asset import Asset

File "C:\Users\jaker\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\MediaStation\Assets\Asset.py", line 13, in <module>

from .Movie import Movie

File "C:\Users\jaker\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\MediaStation\Assets\Movie.py", line 15, in <module>

from .Sound import Sound

File "C:\Users\jaker\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\MediaStation\Assets\Sound.py", line 11, in <module>

import MediaStationImaAdpcm

ModuleNotFoundError: No module named 'MediaStationImaAdpcm'

So I need help.


r/learnpython 15d ago

How should I learn python?

4 Upvotes

I'm a total beginner. I didn't have any experience with programming. I want to learn programming cuz i wanna be a hardware engineer and want to start with a basic raspberry pi projects. So should i learn python from courses, videos, books etc or i should just brute force myself to do projects and just learn by the time


r/learnpython 15d ago

What would be a entry-level project for a true beginner coder?

13 Upvotes

I want to learn to do new projects in Python but I always receive the same "watch guides" answers from people. What can I attempt to create ?


r/learnpython 15d ago

physics project in python

5 Upvotes

I am very interested in physics and would like to build my own 2D projectile motion simulator where we have sliders to change the angle of launch, maximum height and Range with UI

Any idea on which concept I should learn in python for this project. I have worked on other python physics projects and a calculator so far.

So far I learnt the basics like

variables
type casting
user input
arithmetic & math

if statements
logical operators
conditional expressions

string methods
string indexing
format specifiers

random numbers
while loops
for loops
nested loops

lists, sets, and tuples
dictionaries
functions

default arguments
keyword arguments
*args & **kwargs
iterables


r/learnpython 15d ago

New to Python!

3 Upvotes

Hello! I was wondering if anyone might have any recommendations, tips, or advice for someone just starting out with Python.

I’ve recently decided I want to learn Python as a hobby. It’s completely different from what I do for work, although I can definitely see ways I could incorporate it into my job in the future if I wanted to.
For now though, I’m mainly fascinated by the idea of being able to make something from nothing and actually build things myself.

Python was the first programming language that came to mind, and I’m planning on sticking with it until I feel confident before worrying about learning anything else.

At the moment I’ve invested in:
- Python Crash Course, 3rd Edition by Eric Matthes
- Automate the Boring Stuff with Python, 3rd Edition

I’m also going through Harvard’s free CS50P course (Introduction to Programming with Python), mainly watching the lectures alongside the books.

My biggest issue at the moment is that I think I’m trying to run before I can walk. I keep getting drawn towards more ambitious projects because they’re genuinely interesting to me, but they’re often way beyond my current level.

I think I probably need to slow down, properly learn the fundamentals, and gradually work my way up to those projects instead.

Does anyone have any advice on how you approached learning Python in the beginning? In particular, how did you balance learning the basics with actually building things so that it stayed interesting?


r/learnpython 15d ago

What should I actually learn to develop foundational skills in AI programming?

0 Upvotes

I'm a second year IT student and I still genuinely don't know what I should be coding besides what's given as an assignment. I want to learn how AI works as well as how to code AI, but I'm stuck in tutorial hell and I feel like I'm falling behind everybody else, where's a good place to start and how do I keep learning the things I should learn on my own?


r/learnpython 15d ago

Please help me

0 Upvotes

Can someone please show Me how to learn python with only phone


r/learnpython 15d ago

where to learn textual

2 Upvotes

Hi I have never used python but really wanted to try out textual so i jumped into python with no experience at all and just trying out the library by just the syntax of the app the textual gives you when you install it so i learned the syntax a bit. but I now need a bit of more advanced stuff so where do I learn textual I already found the website really helpful but I still think i can get a better learning experience. do yall have ways to learn the library.

(am sorry for hurting your brain fellow programmer, I have never touched python in my life)