r/learnpython • • 43m ago

final project in cs

1 Upvotes

Hello guys, im first year cs student and they teach us python as the first programming language
i dont have any experience what so ever in programming.
we are in the 5th lecture in uni and i have learned the basic stuff like if and elif and while and for looping. The professor assigned us with a final project basically we are 4 and supposed to code a program like more than 300 lines i dont know what can python do and i dont know how am i supposed to build a python project with the knowledge i have

so my question is how do i continue my python learning without the lectures, i have heard about a github project called 30 days of python by asabneh idk if its the right fit

and what are some projects idc how complicated they are i just wanna get that A+ i asked chat gpt abd it told some stuff about movie recommender and football analysis and idk tbh i think everyone in my uni will use chat gpt and they will most likely all do the same project i want to be unqiue and also functional

thanks


r/learnpython • • 2h ago

Help me learn!!

0 Upvotes

So I learned python about 6 or some years ago. So recently I tried to get back but realized I forgot almost everything. So what's the best way currently to start from scratch??


r/learnpython • • 3h ago

Best learning path for GTK and python

4 Upvotes

I'm looking to learn more how to build GTK applications mostly for Fedora using python, I've been doing the CS50P course but also looking for some more learning material any suggestions will be helpful


r/learnpython • • 6h ago

I am once again asking for recommendations of good Python and data science auidobooks and podcast episodes

0 Upvotes

Last time people had some good recommendations, but there were some misunderstandings as well, so I wanted to try asking again while being super clear about some stuff.

I'm learning to code Python from scratch on a university module while also working, so my schedule is super constrained. There is also a data science side to it based on numpy, pandas and matplotlib. We have to analysis some statistics to find interesting answers - very open ended.

Basically, I want to use the 6-10 hrs a week I spend on the road to shore up my understanding of the theoretical side of python and data science so I can focus on coding during the time I have in front of a computer.

Please assume the following:

I'll still be coding in front of a computer in a structured manner when I am not driving.

I am already spending the maximum number of hours coding in front of a computer that I can physically manage, and there is no scope for adding more computer hours.

I am looking to maximise the efficiency of what I can learn during the 6-10 hours I spend driving per week.

My drive is predictable and I can drive safely while listening to audio.

Some good things people have suggested already:

"The Art of Statistics" by david spiegelhalter on Audible

Some episodes of the Talk Python to Me podcast dealing with relevant modules

Python Essentials for Dummies on Audible - has been helpful for reinforcing basic concepts and context

TL:DR Please could you recommend good things I can listen to on my commute to help with Python concepts and data science understanding.


r/learnpython • • 8h ago

How do I force the turtle to draw inside the screen?

1 Upvotes

I've been on that assignement for a while now, the teacher wants us to create a program that will create a 600 by 600 screen and draw 5 randomly placed flowers. But I can't figure out for the life of me why the flowers always "escape" the screen. I didn't want the code to be too long so I didn't include the function that creates the flower. Please and thank you for any help.

screen = Screen()
screen.screensize(canvwidth=600,canvheight=600, bg="grey")
#attempt at creating a restrictive screen

for i in range(5):
    a = 600
    b = 600
    while 600 - a < 550 and 600 - b < 550:
        a = randint(1,601)
        b = randint(1,601)
    penup()
    goto(a,b)
    pendown()
    #attempt at forcing the program to not draw flowers touching the border
    colormode(255)
    color(randint(1,256),randint(1,256),randint(1,256))
    #Chooses a random color for the flower
    begin_fill()
    fleur(50)
    end_fill()
    #Draws a flower  

r/learnpython • • 12h ago

Should I add Python to PATH (Windows)? Or is it better to not add it to path and use the py launcher instead?

4 Upvotes

Title. I'm new to Python, so I'm a little confused about this, and I've been seeing somewhat conflicting information online.

I understand adding the Python installation to PATH implies that I wouldn't manually have to specify the location every time; that being said, I guess adding multiple Python installations to PATH is not a good idea? I've also seen adding *any* Python installations to PATH being discouraged because it can cause conflicts.

I looked up py launcher, and it seems py / py -<version number> can be used to specify which Python installation to use when running a .py file, so does that mean adding Python installations to PATH is just obsolete practice now? If so, what are the implications of using the py launcher - is it as simple as adding py / py -<version number> before running a command from the terminal?


r/learnpython • • 14h ago

Effective python Vs Think Python Vs Learning Python Vs Fluent Python. Reading order for Beginner, Which Book & Why?

14 Upvotes

Effective python Vs Think Python Vs Learning Python Vs Fluent Python

I have these pdfs but dont know which one or in what order to start, as an beginner.

I already finished reading Python Crash course and reading Think Like a Programmer book now.


r/learnpython • • 15h ago

Hello everyone!

0 Upvotes

I just started a new job as an AI generalist (or AI trainer), I like it, I've always liked tech, but I know nothing about programming or anything like that, just the surface as any mortal. So, can I learn python and use my ASUS tuf 14 from 2022 to run the program and learn how to write code and maybe aspire to a good freelancing position later? Thank u in advance, for you answers.


r/learnpython • • 15h ago

Any tips and advice for my first github pages hosted python project?

1 Upvotes

The game is essentially tetris but there is no 4 long line block piece. I observed that a lot of tetris players relied on the I piece as a crutch for their strategy, so I created a spinoff of tetris called Noline in python to test how people would react to the removal of such a central piece.

This is the github link to the source code: https://github.com/keandsilva/Noline

The link to the domain it is hosted on: https://keandsilva.github.io/Noline/

I would love if anybody have any suggestions for anything to add and how my python code is structured. Thanks!


r/learnpython • • 21h ago

Python Auth to modern Microsoft SPO

0 Upvotes

Hi all,
I'm doing my student project to upload some files to SPO and struggling with Auth.
This code returns 0 on first ctx, but later fails.
I hope I got all UID right like on the picture
https://i.postimg.cc/ncw71PzR/conf1.png

And this is my code, I also noticed once you used you tenant ID username and password can take any values, is this normal ? I think this all because of modern SPO security, do you think this Auth with ctx is OK, or can do some other way ?

from office365.sharepoint.client_context import ClientContext

# Configuration
site_url = r"https://cbxXXX.sharepoint.com"
tenant = r"4e4d8cb1-f036-446f-bacd-3b711191a7b2"
client_id = r"5c6d0b11-c4da-4897-842a-79b9743d6a23"
username = r'[email protected]
password = r'N0gi123!'


ctx = ClientContext(site_url).with_username_and_password(
      tenant, client_id , username, password )
print ('.........2222 bb  OK ', ctx)
web = ctx.web.get().execute_query()
print("......... verification check :", web.title)


OUTPUT::::::
.........2222 bb  OK  <office365.sharepoint.client_context.ClientContext object at 0x0000017CCBCE3B60>
.....
Unhandled exception in listener <bound method SharePointRequest._authenticate_request of <office365.sharepoint.request.SharePointRequest object at 0x0000017CCBCE3CB0>>

File "C:\Python314\Lib\site-packages\office365\runtime\auth\token_response.py", line 61, in from_json
    raise ValueError(value)
ValueError: {'error': 'invalid_grant', 'error_description': 'AADSTS50034: The user account {EUII Hidden} does not exist in the 4e4d8cb1-f036-446f-bacd-3b711191a7b2 directory. To sign into this application, the account must be added to the directory. Trace ID: eb657c1d-4806-4557-a49d-f5468c

r/learnpython • • 21h ago

pip vs pipx

0 Upvotes

as far as I understand pip just installs the package while pipx installs the executable and creates an environment but why create an environment in the first place? Is it so that when someone else runs the program and there are changes in the package the program might break but an isolated package is protected in the environment?


r/learnpython • • 22h ago

Looking for "language exchange" partner. Pls read the post haha

2 Upvotes

Hi there. English is my second language, and I sometimes get a hard time trying to figure out some concepts that can have multiple meanings, synonyms, slang or whatever. So I was wondering if there's someone who could give me a hand when having this kind of problems, maybe talk sometime so I can practice my technical conversations etc

And of course if this person is interested in Learning Spanish, I could also help back, I'm from Mexico.

I'm studying an Actuary but I'm pretty interested in CS, specially open source/free software stuff and I use Arch as my OS, learning git so I can go deep in Python(pandas, numpy, matplotlib for now) and save my projects. In holidays planning to spend a little of time learning electronics, etc etc

So if you'd like to help a folk like me, learn about Mexico or Spanish language, send me a message(:


r/learnpython • • 1d ago

I already know Java and want to learn Python. What are some of the best resources?

9 Upvotes

I took up CS extensively throughout high school and generally enjoy programming with Java. I'd say I have an intermediate to upper-intermediate proficiency in Java. That being said, I know little to nothing about Python and would like to learn to code in it as well. I think the logic should be the same since they're both OOP languages.

I looked at some CS50P and the MOOC courses but they start right from the begin and are aimed at those who have 0 programming experience, so I kinda got bored. What do I do?


r/learnpython • • 1d ago

Issues with creating a dialog box for Anki.

3 Upvotes

So I am trying to create a non modal dialog box (or window) supposed to show the content of certain fields from the card I just answered to. I want this window to mimic the main window of the Anki App so that the Yomilens addon which reacts when text is selected on the main one would react the same way when selecting text on this one as well.

import sys
from PyQt6.QtWidgets import*
from PyQt6.QtCore import *
from PyQt6.QtGui import *

class FieldsDialog(QWidget):
    def __init__(self):

        super().__init__()
        self.title = "Fields"
        self.setGeometry(400, 100, 300, 200)
        self.left = 1367 # for it to be on the very left of my right monitor (a tablet)
        
        self.top = 30 #otherwise the upper part is hidden 
       
        self.right = 504
        self.width = 800
        self.height = 1
        self.icon = "?"
        # self._help_dialog = None
        # self._other_dialog = None
        self.createUI()

    def createUI(self):
        self.setGeometry(self.left,self.top,self.right,self.width)
        self.setWindowTitle(self.title)
        self.setWindowIcon(QIcon(self.icon))
        self.setStyleSheet("""
        background: black;
        """)
        self.grid = QGridLayout()
        self.setLayout(self.grid)

def on_show_fields():
    if __name__ == '__main__':
        app = QApplication(sys.argv)
        fields_win = FieldsDialog()
        fields_win.show()
        sys.exit(app.exec())import sys

1 - The window shows while on pycharm (yay) but not in anki. Maybe the type of dialog is not adapted but for now it's been the only thing that worked)

2 - Since there was progress on that part, I was trying to see if my function supposed to get the text for the dialog actually worked

def _get_previous_fields(self, card) -> str | None:
    if not card: return

    note = card.note()
    r = self.mw.reviewer
    # current_id = r.card.id if r.card else "null"
    previous = r.lastCard()
    Front_value = mw.reviewer.card.note()['Front'] if FIELD_FRONT in note else ""
    Back_value = mw.reviewer.card.note()['Back'] if FIELD_BACK in note else ""

    previous_korean = Front_value.previous if previous else "null"
    previous_english = Back_value.previous if previous else "null"
    _queue_toast(f"{previous_korean}+\n+{previous_english}")
    return "{previous_korean}+\n+{previous_english}"

but I keep getting errors like that :

    lambda cid=card.id, e=ease, skip=skip_interval_checks: _post_answer_processing(cid, e, skip)
                                                           ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
TypeError: _post_answer_processing() missing 1 required positional argument: 'self'   

I tried calling in on my on_show_answer

HOOK_ANSWER = reviewer_did_answer_card
if HOOK_ANSWER:
HOOK_ANSWER.append(on_answer)

But i'm told it (on_show_answer) is missing the self argument so I add it :

  File "D:\a\anki\anki\out\installer\build\anki\windows\app\src\app_packages_aqt\hooks.py", line 4390, in __call__
TypeError: on_answer() missing 1 required positional argument: 'self'  File "D:\a\anki\anki\out\installer\build\anki\windows\app\src\app_packages_aqt\hooks.py", line 4390, in __call__
TypeError: on_answer() missing 1 required positional argument: 'self'

I tried using hooks instead

if HOOK_SHOW:
    HOOK_SHOW.append(on_show_question)
if HOOK_ANSWER:
    HOOK_ANSWER.append(on_answer)
    HOOK_ANSWER.append(_get_previous_fields)  #here
if HOOK_SUSPEND:
    HOOK_SUSPEND.append(on_reviewer_suspend)

and I get :

Traceback (most recent call last):
  File "D:\a\anki\anki\out\installer\build\anki\windows\app\src\app_packages\aqt\taskman.py", line 152, in raise_exception
  File "D:\a\anki\anki\out\installer\build\anki\windows\app\src\app_packages\aqt\taskman.py", line 148, in _on_closures_pending
  File "D:\a\anki\anki\out\installer\build\anki\windows\app\src\app_packages\aqt\taskman.py", line 88, in <lambda>
  File "D:\a\anki\anki\out\installer\build\anki\windows\app\src\app_packages\aqt\taskman.py", line 111, in wrapped_done
  File "D:\a\anki\anki\out\installer\build\anki\windows\app\src\app_packages\aqt\operations__init__.py", line 128, in wrapped_done
  File "D:\a\anki\anki\out\installer\build\anki\windows\app\src\app_packages\aqt\reviewer.py", line 556, in after_answer
  File "D:\a\anki\anki\out\installer\build\anki\windows\app\src\app_packages\aqt\reviewer.py", line 566, in _after_answering
  File "D:\a\anki\anki\out\installer\build\anki\windows\app\src\app_packages_aqt\hooks.py", line 4390, in __call__
TypeError: _get_previous_fields() takes 2 positional arguments but 3 were given

Do you happen to know what the issue is ?


r/learnpython • • 1d ago

Get and setter in pyhton

9 Upvotes

I'm learning Python, and this part has left me a little confused, because in other languages the way it's used is different; in Python you use @property, I'd like to understand how this really works in a simplified way, so I can truly grasp it and not just memorize it. If you could help me, I'm still new to programming.


r/learnpython • • 1d ago

How should I start learning Backend Development with Python as a beginner?

0 Upvotes

Hello everyone!

I'm a B.Tech CSE Cybersecurity student. I know Python basics and now want to start learning backend development.

I'm a complete beginner in backend development, so I'm confused about where to start and what resources to follow.

I have a few questions:

  1. Where should I start learning backend development?

  2. What topics should I learn first?

  3. Which backend framework should I choose: Django or FastAPI?

  4. What are the best free YouTube channels or courses to learn backend development from scratch?

  5. Are there any good beginner-friendly websites or documentation?

  6. How should I practise while learning?

I'm looking for a clear learning direction and good free resources.

Any suggestions or guidance would be really helpful.

Thank you!


r/learnpython • • 1d ago

Les meilleures projet a faire sur python

0 Upvotes

Salut j'apprends python et je le demandait qu'elle sont les meilleures truc à faire avec python je devloppe un petit rpg textuelle on m'as dis que c'était le meilleur moyen d'apprendre python mais problème je nais d'idées de projets à faire après se rpg je n'apprend pas vraiment pour ma carrière professionnelle j'ai juste 14 ans boucoup font des jeux sur python pour ça je préfère utiliser le moteur de jeux godot son langage prioritaire est similaire à python je me le garde pour plus tard quand j'aurai bien maîtriser python mais avant je pence qu'apprendre à faire des site Web serait cool donner moi votre avis je sais que j'ai parler de boucoup de sujet à la fois mais merci pour les personnes qui répondrons


r/learnpython • • 1d ago

Looking for interesting Python project ideas for a university assignment (3-week deadline)

12 Upvotes

Hi everyone!

I'm a physics student and I have to complete a Python programming project for one of my university courses. I have approximately 3 weeks to work on it, and I'm looking for some interesting and original project ideas.

Here are the requirements the project must meet:

  • The code must be functional, readable and written in a Jupyter Notebook.

  • Proper documentation is required.

  • It must include data import or export, as well as data processing.

  • It must use programming structures such as classes and functions.

  • It must include at least one visualization (graphs, data representation, etc.).

  • It must implement at least two numerical methods.

I'm still a beginner in Python and don't have much programming experience yet. So I'm looking for something achievable within three weeks, without being overly complicated technically.

One idea I had was to build a movie recommendation system, but I'm open to pretty much anything, including projects unrelated to physics!

What kind of projects would you recommend that could meet these requirements? If you've worked on similar projects or have any examples, I'd love to hear about them!


r/learnpython • • 1d ago

Alternative Discord

0 Upvotes

Is there an alternative to the python discord? The entire server has been overrun with LLMs and beginners that have no interest in actually learning. I'm looking for a server with real project/language discussion.


r/learnpython • • 1d ago

Using Sympy, is there a way to detect repeating fractions?

3 Upvotes

I know I can transform a repeating fraction in a numerical fraction with sympify (i.e sympify("0.[3]") = 1/3), but can it go the other way around?


r/learnpython • • 1d ago

How do I make this [1,2,3,4,5,] look like this?

0 Upvotes

1

2

3

4

5


r/learnpython • • 1d ago

I am a college student struggling with intro to programming! Help?

0 Upvotes

Program written in Python containing:

a. An empty list that will contain float values of lap speeds.

b. A loop which gets input from user on lap speeds. This loop continues until the user enters -1.

c. While the loop iterates, the application adds the lap speed to the list.

d. Upon termination of the loop, the application displays:

i. Fastest lap speed formatted with two decimal places

ii. Slowest lap speed formatted with two decimal places

iii. Average lap speed formatted with two decimal places

e. The application displays all of the laps on screen formatted with two decimal places.

def main():


    lapSpeeds()


def lapSpeeds():
    lapTime=[] #empty list
    lapSpeed = float(input("Enter the time the lap took to complete(-1 to calculate): ")) #start loop
    lapNum = 0


    while lapTime != -1:
        
        lapTime.append(lapSpeed)
        lapNum += 1
        lapSpeed = float(input("Enter the time the lap took to complete(-1 to calculate): ")) #append loop


        print(lapNum, ".) ", lapTime " mph")


    else:


        fastLap = (max.lapTime)
        slowLap = (min,lapTime)
        avgLap = lapTotal/lapNum


        print("Fastest Lap: ", format(fastLap, ".2f") "mph")
        print("Slowest Lap: ", format(slowLap, ".2f") "mph")
        print("Average Lap: ", format(avgLap, ".2f") "mph")


main()

This is what I get. what am I doing wrong?!

Enter the time the lap took to complete(-1 to calculate): 48949

Enter the time the lap took to complete(-1 to calculate): -1

1 .) [48949.0]

Enter the time the lap took to complete(-1 to calculate): 457

2 .) [48949.0, -1.0]

Enter the time the lap took to complete(-1 to calculate):

Also, the output should look like this

EX:

**************************************************************************************

Enter the time the lap took to complete(-1 to calculate): 199.56

Enter the time the lap took to complete(-1 to calculate): 200.01

Enter the time the lap took to complete(-1 to calculate): 200.98

Enter the time the lap took to complete(-1 to calculate): 199.94

Enter the time the lap took to complete(-1 to calculate): 200.64

Enter the time the lap took to complete(-1 to calculate): -1

Fastest Lap: 200.98 mph

Slowest Lap: 199.56 mph

Average Lap: 200.23 mph

Lap Speeds

1.) 199.56 mph

2.) 200.01 mph

3.) 200.98 mph

4.) 199.94 mph

5.) 200.64 mph

******************************************************************************************


r/learnpython • • 1d ago

Can someone help teach me how to code a reminder system like Duolingo (Chrome extension)

3 Upvotes

This is for the students I tutor! [to remind them to do homework, and practice everyday :)] it can also be used in a lot of other applications.

I am a week into learning python using Matthew's crash course and was wondering what steps I could take to build this, how long it would take, tips, etc.

I feel like I know basically nothing about this lol.

Happy to collab


r/learnpython • • 1d ago

Beginner needing help with StoryBot/Storyboard and OpenMontage – Stuck setting up AI video production

1 Upvotes

Hello everyone!

I'm looking for someone experienced with Python, AI video generation, automation, and OpenMontage who can guide me through a project I'm building.

I'm a complete beginner with very little programming knowledge. Most of my setup has been done by following instructions from ChatGPT and Gemini, copying commands into PowerShell, and troubleshooting errors. I've managed to install quite a lot, but I'm struggling to put everything together and actually produce videos.

I would really appreciate patient, step-by-step guidance.

  1. StoryBot / Storyboard

My first project is an automated storytelling video system for YouTube Shorts, Instagram Reels, TikTok, and Facebook Reels.

What I've installed and configured:

- Ollama with Qwen3:4b for local story generation.

- Node.js, npm and n8n (installed locally, not Docker).

- Python 3.11.9 and FFmpeg 9.0.2.

- Parody TTS for narration.

- Custom Python scripts.

My n8n workflow currently works up to this stage:

  1. I press Execute.

  2. Python scripts generate a story.

  3. A temporary "story.txt" file is saved.

  4. Narration is generated in parallel.

  5. The narration is saved in the output folder.

So story generation and narration are working.

ComfyUI experiment:

I also installed ComfyUI at:

"D:\StoryBot\ComfyUI-Install\ComfyUI_windows_portable"

I downloaded two model files:

- "flat2DAnimerge_v45Sharp.safetensors" (approximately 2.13 GB) – Stable Diffusion 1.5 checkpoint for 2D cartoon-style images.

- "mm_sd_v15_v2.ckpt" (approximately 1.82 GB) – AnimateDiff motion module.

I wanted to generate and animate cartoon-style characters, but my GTX 1660 with 6 GB VRAM struggled with the workload. Generation was taking too long, so I couldn't get the results I wanted.

I currently have one male and one female presenter character as basic static images.

2. OpenMontage (Separate Project)

After getting frustrated with my Storyboard setup, I decided to try OpenMontage as a completely separate alternative.

I'm NOT trying to connect OpenMontage with StoryBot/Storyboard.

Repository: https://github.com/OpenMontageInc/OpenMontage

Installed/configured:

- Python 3.11.9 virtual environment.

- Node.js v24.22.1 and npm 11.19.1.

- FFmpeg 9.0.2 and Git 2.56.0.

- Remotion dependencies.

- esbuild 0.28.1.

- HyperFrames 0.9.39.

- Piper TTS 1.8.0.

- pytest 9.2.0.

- ".env" configured from ".env.example".

I successfully ran:

"python scripts/backlot_simulate_run.py"

It generated a demo production with scenes sc1–sc4.

I can also access the Backlot interface:

"http://127.0.0.1:4750/p/backlot-demo-run"

However, I'm stuck on what to do next and how to move from the simulation to an actual rendered video.

3. My desired video appearance

- Word-by-word animated subtitles.

- Currently spoken word highlighted in blue.

- Remaining words in white.

- Purple/red gradient backgrounds.

- Two consistent presenter characters.

4. My PC specifications

- Windows 11 Pro.

- AMD Ryzen 5 5600.

- NVIDIA GTX 1660 Gaming X (6 GB VRAM).

- 16 GB RAM.

I prefer free and open-source tools and want to run as much as possible locally.

5. What I need help with

StoryBot / Storyboard:

- How do I complete the existing workflow and produce videos?

- How should I use my presenter images?

- Are there lighter alternatives to ComfyUI/AnimateDiff that work on my GPU?

OpenMontage:

- How do I use Backlot properly?

- What are the next steps after a successful simulation?

- How do I produce an actual video?

I'm not trying to combine these two projects. I want to understand them separately.

6. How I would like to be guided

Please understand that I'm genuinely new to programming.

I would appreciate someone who can:

- Start from my existing installations.

- Give me one step at a time.

- Provide exact commands and tell me where to run them.

- Explain what each step does.

- Wait for my results before moving forward.

- Help me troubleshoot errors.

I've spent a lot of time getting this far, and I don't want to break my existing setup by randomly changing things.

If anyone has experience with OpenMontage, Remotion, ComfyUI, Python automation, or AI video production, I'd really appreciate some guidance.

Thank you for reading!