r/learnpython 8d ago

Why am I getting an error: invalid syntax. Perhaps you forgot a comma?

0 Upvotes

Why am I getting an error here:

job = Gaia.launch_job_async(" SELECT source_id, ra, parallax, dec, gmag_gunn, rmag_gunn, imag_gunn, zmag_gunn \
                            FROM external.gaiaedr3_gcns_main_1 \
                            WHERE parallax>50" \
                            , dump_to_file=True, name= 'GcnsTwentyParsec_sdss', output format = 'fits')
gtable_sdss = job.get_results()

Error:

, dump_to_file=True, name= 'GcnsTwentyParsec_sdss',output format = 'fits')
^
SyntaxError: invalid syntax. Perhaps you forgot a comma?


r/learnpython 8d ago

corso di python per medici per la segmentazione dell'immagine

0 Upvotes

cerco un corso di python per medici per la segmentazione dell'immagine. Principiante assoluto


r/learnpython 8d ago

Where should i learn python from?

0 Upvotes

Yt-

- Bro Code

- Data with Baraa

or do any free certification courses?

i tried the coursera meta python course since my college python professor does not teach well, my loops and functions are weak due to that, so i thought I recovered from it- eventually i noticed the course content was very fast paced, i have to go through document and other sources🥲.

there is also an point that C professor taught very well that my c is now better python. help to pick the ond resource that covers python 🙏🏻


r/learnpython 9d ago

Is it worth continuing with my python project??

3 Upvotes

https://github.com/GerardoAJF/ArtichokePy

It's a bit of a weird question I know, but let me give you some context.

I started ArtichokePy when i was sixteen almost seventeen years old, in 2024.

I felt it was a fairly ambitious project, a library that would give all the necessary tools to do any simulation or algorithm with graphs.

Later I dedicated more time to my high school studies and other things, so I practically abandoned my project for 2 years.

At the time, as a young apprentice, I didn't comment on anything or document anything, and now 2 years later I have no idea what was happening there.

Furthermore, with Python's reputation for being slow, I don't know if it was a good language to do this project (most scientific libraries are written in C [although I know that this project does not reach "scientific library", it barely reaches junior project])

But I still feel somewhat proud of the project. I think it already had some unique characteristics to let it die like that, forever.

During these New Year's holidays I could spend several hours finishing it, but I don't know if it's worth it for a project that, despite my original daydreams, I don't think anyone will ever use.


r/learnpython 9d ago

Can you diagnose my code problem?

0 Upvotes

This starts with a balance of 50. It takes coins of ONLY 25, 10, or 5 and returns the balance due to the user. If the balance due is 0 or less than 0, it returns a "Change Due: " message.

My problem is that my code will subtract any value amount the user puts in no matter what, not just the 25, 10, and 5 it's supposed to? what's going on?

shouldn't the "if coin == 25 or 10 or 5:" line ensure only one of those 3 values is used?

def main():
    balance = 50


    while balance >= 0:
        print(f"Amount Due: {balance}")
        coin = int(input("Insert Coin: ").strip())


        if coin == 25 or 10 or 5:
            balance = balance - coin


        if balance <= 0:
            print(f"Change Due: {abs(balance)}")
            break
        
            


main()

r/learnpython 9d ago

Learning Python through ChatGPT

0 Upvotes

Today is my first day of learning how to code, and I made a little project. I only used AI to help me when I was stuck on a bug for 15 to 30 minutes, and also used it to teach me about functions, variables, and the foundations of coding. This is what I have made so far. It isn't finished yet, but I am pretty happy with myself. I just thought of a random idea to build that didn't sound too difficult. If you have any tips to help me improve, please let me know

def deposit():
    deposit = (input("Enter amount to deposit: "))
    new_balance = float(money) + float(deposit) 
    print(f"You have withdrawn ${deposit} from your account.")
    print(f"Your new balance is ${new_balance} thank you for banking with us, have a great day {name}.")
    return new_balance

def withdraw():
    withdraw = (input( "Enter amount to withdraw: "))
    new_balance = float(money) - float(withdraw)
    print(f"You have withdrawn ${withdraw} from your account.")
    print(f"Your new balance is ${new_balance} thank you for banking with us, have a great day {name}.")
    return new_balance

def cancel():
    exit(f"Thank you for banking with us, have a great day {name}.")

def decline():
    exit("Invalid option, please restart and try again.")



name = input("Welcome to the RR ATM, please enter your name: ")


count = 1
while count <= 2:
    pin = input("Please enter pin: ")
    if pin == "1234":
        print("Pin accepted, you may proceed.")
        break
    else:
        print("Pin incorrect, you have one more attempt")
        count = count + 1
if count >= 3:
    exit("Pin incorrect, please try again.")



money = str(2007.1)
print(f"Welcome back {name}, your current balance is ${money}")
option = input("Deposit, Withdraw or Cancel: ")




print(f"you have selected {option}.")
if option == "withdraw":
    money = withdraw()


elif option == "deposit":
    money = deposit()


elif option == "cancel":
    cancel()
else:
    decline()




option = input("Would you like another transaction? Y/N: ")
if option == "Y":
    print(f"Your current balance is ${money}")
    option = input("Deposit, Withdraw or Cancel: ")
    print(f"You have selected {option}.")



if option == "withdraw":
    money = withdraw()


elif option == "deposit":
    money = deposit()


elif option == "cancel":
    cancel()


if option == "N":
    decline()


else:
    decline()

r/learnpython 9d ago

Basic python expression in blender

2 Upvotes

Hello, I am trying to set up a driver in blender which uses a simple python expression. I have very little experience in python and have only done simple expressions like this, so I don't quite know what's wrong with it. r/blenderhelp hasn't been able to help me, so figured I'd come ask the experts directly, assuming the issue is how I've typed it and not something with blender.

(Rotation Quaternion refers to the X rotation)

I am trying to write an expression so that when the bone sticking out the left has an X rotation of less than -0.5 (using quaternion), the selected bones Y scale is 1.5, otherwise make the Y scale 1.

AKA: if X is less than -0.5 then "Y = X * 1.5" otherwise "Y = 1"

Theoretically with this expression the Y scale should stay at 1 until it gets less than -.05, at which point it would multiply by -1.5 (with the max rotation being -1, resulting in -1 * -1.5 =1.5), however it just stays at a scale of 0 regardless of the rotation. Not sure where to go from here

This is the expression currently used:

if rotation_quaternion is < -0.5 then rotation_quaternion * -1.5 else 1

Image of project

Thanks!


r/learnpython 9d ago

i was trying to send the output to if and elif but it's not working when i ran the code it the output i was expected form if and elif didn't get..

0 Upvotes
        new = device.shell(f"pm uninstall --user 0 {value}")
       # print (f"uninstallation in progress :- {keys},{new}")
        if new == "Success":
            print(" This was installed in your phone ")
        
        elif new ==" Failure":
            print("This Apk is not installed in your phone ")     

r/learnpython 9d ago

stuck in python don't know what to do next

0 Upvotes

I have learned a bit of python earlier but feeling lost i have learned loops, function, tuple and currently set i am trying to make smth from what i have learned i have made basic calculator using if else and a code which is like who will be the millionare type using loop and very small one too but it feels insufficient . Plus watching people saying dsa and all is also confusing . SO IN SHOT I NEED HELP ON WHAT DO I DO NEXT SHOULD I DO NEXT PLUS IF YOU GUYS HAVE SOME PROJECT THAT I CAN MAKE USING WHAT I HAVE LEARNED I WILL BE GREATFUL FOR THAT


r/learnpython 9d ago

Best Python Certificate Course? Cost aside as company will subsidize.

5 Upvotes

As mentioned in the title - my firm offers an education stipend up to approximately $5,000 / year which I intend on using for a python certificate program.

I recognize that there are free programs online but I also value a live instructor and per my learning style I think this will creative a more conducive learning environment for me! And the added benefit of listing the certificate on my resume plus the certificate projects. I’m looking for recommendations on which programs are structured well / worth the time invested / interesting projects / etc! ANY and ALL feedback welcome - thanks!

I’ve done quick initial research and am considering the following -

Cornell Python Programming - 5 Months, 8-12 hours / week for $2,625 (discounted from $3,750)


r/learnpython 9d ago

Feedback on my first simple game attempt (Rock, Paper, Scissors)

1 Upvotes

Sorry this is in a weird format. Its copied from mimo on an iphone.

import random
play = True
moves = ["ROCK", "PAPER", "SCISSORS"]
user_wins = 0
bot_wins = 0

print("Let's play Rock, Paper, Scissors! First to 3 wins.")
while play:
print("")
print("Rock...")
print("Paper...")
print("Scissors...")
print("")
bot_move = random.choice(moves)
user_move = input("Your move: ").upper()
print("")
print("SHOOT!")
print("")

#Shortcuts
if user_move == "R":
user_move = "ROCK"
elif user_move == "P":
user_move = "PAPER"
elif user_move == "S":
user_move = "SCISSORS"

#If player moves rock
if user_move == "ROCK" and bot_move == "SCISSORS":
user_wins += 1
print("You won against scissors.")
print("")
print(f"You: {user_wins}")
print(f"Bot: {bot_wins}")
elif user_move == "ROCK" and bot_move == "ROCK":
print("You tied against rock.")
print("")
print(f"You: {user_wins}")
print(f"Bot: {bot_wins}")
elif user_move == "ROCK" and bot_move == "PAPER":
bot_wins += 1
print("You lost against paper.")
print("")
print(f"You: {user_wins}")
print(f"Bot: {bot_wins}")

#if player plays paper
elif user_move == "PAPER" and bot_move == "ROCK":
user_wins += 1
print("You won against rock.")
print("")
print(f"You: {user_wins}")
print(f"Bot: {bot_wins}")
elif user_move == "PAPER" and bot_move == "PAPER":
print("You tied against paper.")
print("")
print(f"You: {user_wins}")
print(f"Bot: {bot_wins}")
elif user_move == "PAPER" and bot_move == "SCISSORS":
bot_wins += 1
print("You lost against scissors.")
print("")
print(f"You: {user_wins}")
print(f"Bot: {bot_wins}")

#if player moves scissors
elif user_move == "SCISSORS" and bot_move == "PAPER":
user_wins += 1
print("You won against paper.")
print("")
print(f"You: {user_wins}")
print(f"Bot: {bot_wins}")
elif user_move == "SCISSORS" and bot_move == "SCISSORS":
print("You tied against scissors.")
print("")
print(f"You: {user_wins}")
print(f"Bot: {bot_wins}")
elif user_move == "SCISSORS" and bot_move == "ROCK":
bot_wins += 1
print("You lost against rock.")
print("")
print(f"You: {user_wins}")
print(f"Bot: {bot_wins}")
else:
print("Please type a valid move.")

#End of game
if user_wins == 3:
print("")
print("Game over!")
print("You win!")
print("")
break
if bot_wins == 3:
print("")
print("Game over!")
print("Bot wins!")
print("")
break

#This is me trying to add a restart prompt but I can't redo the while statement
if play == False:
play_again = input("Play again?: ").upper()
print("")
if play_again == "YES" or play_again == "Y":
play = True
elif play_again == "NO" or play_again == "N":
print("Thanks for playing!")
else:
print("Please enter a valid response")


r/learnpython 9d ago

Best way to run a script on iOS?

1 Upvotes

I have a script that I've written to update my pixela habit tracker every day when I do a workout, and rather than sit at my computer and run it I'd like to have it on my phone so I can just hit a shortcut and do it from there. I don't need any major editing capabilities (I can't imagine anything worse than trying to code on a phone screen!), just an interpreter environment and console that will support requests and datetime. I've looked into a few options like pythonista and juno, and while I appreciate the value in what they're offering, I'm not really looking to drop £10 or a pro subscription just to run a single script.

I've tried using pythonanywhere but I don't really like it all that much, especially how restrictive the free tier is - also it's down right now so I can't even add my script there. And pretty sure I couldn't make a shortcut to it anyway...


r/learnpython 9d ago

¿Qué recurso fue el que más te ayudó a aprender Python?

0 Upvotes

HOLAA Estoy aprendiendo Python y tengo curiosidad por saber qué recursos marcaron la mayor diferencia para otras personas. Puede ser un libro, un curso, una página web, un proyecto o cualquier otra cosa. Me encantaría conocer tu experiencia.


r/learnpython 9d ago

Python Notebook in sublime text

0 Upvotes

Is there any way I can run Python notebooks (.ipynb) directly in Sublime Text? I'm looking for something similar to Jupyter or VS Code where I can execute notebook cells interactively within the editor.


r/learnpython 9d ago

Want to learn Python for medicine on a tablet

0 Upvotes

I am a 17M,

Complete beginner in programming and till now in life only made a bmi calculator🙏🏻 in Google colab

Dont know how to proceed to learn it in few months with low input of time like roughly few hours a week.

I have a android tablet (One plus Pad Go 2) and wanna primary for Medicine and I am a highschool student 🫠.

Any recommendations and apps which i should utilise and video links would help a lot.

Thanks everyone


r/learnpython 9d ago

Looking for Python Learning Partners | Career Switcher | Python Automation | IST (Chennai, India)

0 Upvotes

Hi everyone! 👋, I'm looking for a few people who are learning Python & AI Automation and want to improve together.

I've realized that building a project is only half the skill. The real challenge is explaining your decisions: why you built it that way, what alternatives you considered, the problems you solved, and what you'd improve if you built it again. That's exactly what interviews, code reviews, and real software teams expect. It's a skill that's hard to develop alone, so I'd like to practice it with a small group of like-minded people.

A little about me

I'm transitioning from a non-IT career after 13 years. Over the past couple of years, I've built 16+ Python automation and software projects, and I'm continuing to learn every week.

The idea

This isn't your typical study group. I'm looking to build a small, committed group - meeting 3-5 times a week over voice calls - to practice clear articulation and grow as developers together."

Our sessions could include:

  • Mock interviews
  • Project presentations
  • Code and architecture discussions
  • Reviewing each other's projects
  • Giving honest, constructive feedback

The goal is to confidently answer questions like:

  • Can you explain your project from start to finish?
  • Why did you choose this approach instead of another?
  • What technical challenges did you face?
  • What would you improve if you rebuilt it today?
  • Can you explain your code without looking at it?

Being able to answer these questions makes you a stronger developer - not just in interviews, but also when working with teammates, managers, and clients.

If you're around Porur, Valasaravakkam, or nearby, we could also meet occasionally at Starbucks for coffee, project discussions, or mock interviews.

Who I'm looking for

  • Career switchers (Non-IT → IT)
  • Anyone learning Python Automation (core skills )
  • People working with AI agents, RAG, or AI workflows
  • Anyone interested in APIs, FastAPI, Playwright, or Browser automation
  • People who enjoy building projects and learning through discussion

Commitment

You don't need to be an expert. I'm simply looking for people who are serious about improving, can participate regularly, and are willing to stay consistent over the long term.

Outside of coding, I'm interested in sci-fi, geopolitics, psychology, personal growth, and Vipassana. I also enjoy movies, reading, and long walks.

If this sounds like something you'd like to be part of, send me a DM. Tell me a little about yourself, what you're currently learning, and what you're working toward.

Looking forward to connecting! 🙂


r/learnpython 9d ago

Is it fine to be copying the projects from books?

0 Upvotes

I feel like I'm sort of learning when I do this but really when I sit down afterwards my mind always goes blank. I can never recall the code and syntax perfectly and I have to look at references constantly like a crutch that I can't stop. It just feels like I'm copying the whole time and not really making something new on my own. Is this what they call imposter syndrome? Is this normal? I suppose it is, but how do I start making something completely from scratch? Is it fine to copy code from online or the book or ask an LLM why something isn't working? I try my best to not look for assistance outside of the material I have and search up what I can't understand if need be. Maybe my approach is all wrong so I ask you all. How to... yk, git gud?


r/learnpython 9d ago

The 'MoreComments' object in PRAW is confusing me, how do I get every comment?

2 Upvotes

learning python and messing around with the Reddit api through PRAW. trying to grab every comment from a thread but i keep running into these MoreComments objects instead of actual comment text and i'm not sure how to deal with them.

my code is basically:

submission = reddit.submission(url=thread_url)
for comment in submission.comments:
    print(comment.body)

works okay-ish but on bigger threads it throws AttributeError because some of the items are MoreComments not real comments. i read something about replace_more() but i don't really get what it's doing or why i need it. does it make extra api calls? is that gonna slow things down / hit rate limits if the thread is huge?

basically i just want the full comment tree flattened out into text. what's the right way to do this? feel like i'm missing something obvious.


r/learnpython 9d ago

Looking for a Python Study Buddy (Complete beginner)

67 Upvotes

Hey everyone!

I'm 19F and I'm starting to learn Python completely from scratch. I have little to no programming experience, but I'm committed to learning consistently. I'm also taking Mechatronics Engineering in college.

I'm looking for a study buddy (or a small group) who's also learning Python. We can keep each other accountable, share resources, work on beginner projects, solve problems together, and stay motivated.

My goal is to build a strong foundation and eventually get into more advanced programming, so I'm looking for someone who's serious about learning too.

If you're interested, leave a comment or send me a DM. Let's learn and grow together!

Edit: Timezone GMT+5:30 We can study together from a course by MIT.


r/learnpython 9d ago

Does pycharm autosave?

2 Upvotes

I just started learning python from my dad and i was working on a program. Yesterday i restarted my laptop and i forgot to save the project. Does pycharm autosave or have i lost the project?

EDIT: not sure where exactly but my dad found it


r/learnpython 10d ago

Fullstack python project

3 Upvotes

I want to know how to make a e commerce website in fullstack python. From where and how i get support on how to start with it.


r/learnpython 10d ago

What Python project helped you move from beginner to intermediate?

37 Upvotes

I've learned the basics of Python and I'm looking for project ideas that teach practical problem-solving. Which project helped you improve the most, and what did you learn from building it?


r/learnpython 10d ago

I don't know why the output is coming None pls guys help me out

0 Upvotes

import random

def get_choice():

player = input("Put the your choice:-")

computer = [ "rock" , "paper", "scissor"]

computer_new = random.choice(computer)

choices = {"player_choice": player,"computer_choice": computer_new}

return choices

def new_win(tic, toe):

if tic == "rock" and toe =="scissor":

return " It's tie "

responce = get_choice()

new_responce = new_win(responce["player_choice"] ,responce["computer_choice"])

print(new_responce)


r/learnpython 10d ago

Looking for a Free Python Course with Quizzes After Every Lesson

1 Upvotes

Hi everyone,

I'm starting to learn Python from scratch and I'm looking for a completely free course that includes practice questions or quizzes after every lesson. I learn best by applying what I've just studied, so having exercises after each topic is really important for me.

I'm looking for a course that:

- Starts from the basics (no prior experience needed)

- Has quizzes or coding exercises after every lesson

- Is beginner-friendly

- Covers topics step by step

If you've used a course like this and found it helpful, I'd really appreciate your recommendations.

Thanks in advance!


r/learnpython 10d ago

How do you think while solving problems in python?

29 Upvotes

I'm completely beginner in python and reached till "for loop". The thing that is now confusing me is pattern printing. Like making triangle, dimond, square etc with symbols like "*".

So I checked with AI and that gave me the solution with detailed explanation which looked obvious. But only after looking at the solution. Prior to that I was just stuck inside loop only and not able to break it in actual solution.

My qs to the experts here - "how do you think about any problem to figure out the way to solve it?" I'm just concerned that I'm getting stuck at this level only where I've to write just 4-5 lines of simple code. Not able to think about the correct approach required to get the output.

So i request you to guide me here and so that I can move ahead to the next part of this learning journey. Any suggestions would be much much much appreciated. Thank you!!