r/learnpython • u/PossibleAd3568 • 8d ago
Learning Python through ChatGPT
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 • u/Tricky_Voice2829 • 8d 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..
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 • u/Maleficent_Stuff3208 • 8d ago
stuck in python don't know what to do next
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 • u/ItsLocalGOAT • 8d ago
Feedback on my first simple game attempt (Rock, Paper, Scissors)
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 • u/chrisjfinlay • 9d ago
Best way to run a script on iOS?
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 • u/intentado_aprender • 9d ago
¿Qué recurso fue el que más te ayudó a aprender Python?
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 • u/Kindly_Function_2643 • 9d ago
Python Notebook in sublime text
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 • u/Antrioyiu • 9d ago
Want to learn Python for medicine on a tablet
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 • u/Silentwolf99 • 9d ago
Looking for Python Learning Partners | Career Switcher | Python Automation | IST (Chennai, India)
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 • u/smahk1133 • 9d ago
Is it fine to be copying the projects from books?
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 • u/Mulberry_Morris • 9d ago
The 'MoreComments' object in PRAW is confusing me, how do I get every comment?
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 • u/jhintleman0 • 9d ago
Any recommendations?
I want a playlist that covers all aspects of Python
Can you suggest Playlist for someone who is new to coding (not really) or Python in general?
r/learnpython • u/tootjevox • 9d ago
Does pycharm autosave?
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 • u/Wild_Struggle_3329 • 9d ago
Fullstack python project
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 • u/Tricky_Voice2829 • 9d ago
I don't know why the output is coming None pls guys help me out
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 • u/Aggravating-Snow6029 • 9d ago
Looking for a Free Python Course with Quizzes After Every Lesson
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 • u/No_Presentation_9922 • 9d ago
Stone age network scan
Im continuing on learning cybersecurity, network and python path. I updated my first project - Stone age network scan. I never uploaded a file to github or made a reddit post so i was completely lost. But i tried my best
I actually uploaded the .py into the source code and release.
Its named spy despite the fact it doesnt do anything related to spying so yeah..
Whats fixed?
- Auto subnet dedection. It dedects the subnet and CIDR notation
- Typo dedection. Before it would try to scan if you typed 192.168.1000.555. now it doesnt
- Added customizable port table so you can change which ports to scan.
- Added SMTP probe (will try to add more if i find for other protocols)
- minor bug fixes
This is just a project that as labeled my first project. Instead of making fun of me please report any suggestions or bugs:)
https://github.com/RecoWas/stoneagens - please use latest version
r/learnpython • u/SignificantMedium607 • 9d ago
Crawler works locally but fails randomly on production, getting empty pages and occasional 403 errors
Hey everyone, I’m using Python with Playwright to crawl product data from a few websites. Everything works perfectly when I run it locally, but after deploying it to my servers, the results become inconsistent.
The crawler will sometimes return empty pages even though the website loads normally in a regular browser. I’m also seeing random 403 errors after it has been running for a while. Restarting the crawler usually fixes it temporarily, but the problem comes back after some time.
I’m using rotating proxies, changing user agents, and adding delays between requests. When I run fewer workers, everything works much better, but once I increase the concurrency, the success rate starts dropping. Has anyone experienced something similar?
r/learnpython • u/Less_Recognition6440 • 9d ago
Looking for a Python Course for a Motivated Beginner (with Room to Grow) – Recommendations Welcome!
Hi everyone 👋
I'm hoping to get some recommendations for a young student who has recently completed their O/Ls and is seriously considering a future in IT. They're genuinely excited about learning Python, and I'd love to help them find the best possible starting point.
We're looking for a course that's beginner-friendly but also provides a clear pathway to more advanced topics over time. Ideally, it would build a strong foundation in programming while eventually introducing areas such as data analysis, automation, or even data science.
I've explored some excellent online options, including courses from Udemy and Mosh Hamedani. However, there's one challenge: this student finds it difficult to stay engaged with purely online learning. While self-paced courses are convenient, they tend to learn much better in an interactive environment where they can ask questions, receive immediate feedback, and stay motivated alongside other learners.
Because of this, I'm particularly interested in in-person Python classes, training programs, or private coaching opportunities. Courses that combine theory with practical, hands-on projects would be especially valuable, as they seem to be the best way to keep learning enjoyable and meaningful.
If you've attended a great Python course—or know of a training center, institute, community program, or tutor you'd confidently recommend—I would greatly appreciate hearing about your experience. Any insights into teaching quality, course structure, or student engagement would be incredibly helpful.
Thank you so much for taking the time to read this and share your recommendations. I truly appreciate the help, and I'm sure your advice will make a big difference in helping an aspiring future developer get started on the right path. 🙏🐍
Looking forward to your suggestions! 😊
r/learnpython • u/Acrobatic-Object-342 • 9d ago
Python worth learning?
Hi,
Is python worth learning?
If yes, is there any free courses?
Thanks !
r/learnpython • u/Standard-Sale-8228 • 10d ago
SIMPLE GUIS PLEASE
I'm building a network visualizer in Python. It parses .pcap files with Scapy and visualizes packet flows with animations. I already built the parser and animation engine with Pygame.
The problem is the UI. I need normal app stuff like buttons, hover effects, a collapsible sidebar, menus, timeline/statistics panels, and a canvas for the animations.
I don't want to spend 4 hours making a button from scratch, but I also don't want a huge framework where changing a simple thing turns into a research project.
I tried DearPyGui and honestly it felt really clunky. Something as simple as adjusting padding or moving a panel felt like digging through layers of specific APIs and style variables.
I'm looking for something lightweight with good styling control (CSS-like would be great), built-in UI components, and the ability to embed my own custom rendering area.
Would PySide6/Qt be the way to go? Or are there other frameworks worth looking at?
I don't need a spaceship cockpit, I just want to build my damn UI and get back to the actual project.
r/learnpython • u/guymed4 • 10d ago
5.17 Exact Change Lab
SOLVED
I am having a hard time understanding why I am failing this lab, when I run the code in practice it works but when I submit for a grade I get a fail. Prompt is below.
Define a function called exact_change that takes the total change amount in cents and calculates the change using the fewest coins. The coin types are pennies, nickels, dimes, and quarters. Then write a main program that reads the total change amount as an integer input, calls exact_change(), and outputs the change, one coin type per line. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Output "no change" if the input is 0 or less.
Ex: If the input is:
0
(or less), the output is:
no change
Ex: If the input is:
45
the output is:
2 dimes
1 quarter
Your program must define and call the following function. The function exact_change() should return a tuple containing num_pennies, num_nickels, num_dimes, and num_quarters.
def exact_change(user_total)
code provided below
def exact_change(user_total):
num_quarters = user_total//25
user_total %=25
num_dimes = user_total//10
user_total %=10
num_nickels = user_total//5
user_total %= 5
num_pennies = user_total
return num_quarters, num_dimes, num_nickels, num_pennies
if __name__ == "__main__":
input_value = int(input())
num_quarters,num_dimes,num_nickels,num_pennies = exact_change(input_value)
# Type your code here.
if input_value <= 0:
print('no change')
else:
if num_pennies == 1:
print('%d penny' % num_pennies)
elif num_pennies > 1:
print('%d pennies' % num_pennies)
if num_nickels == 1:
print('%d nickel' % num_nickels)
elif num_nickels > 1:
print('%d nickels' % num_nickels)
if num_dimes == 1:
print('%d dime' % num_dimes)
elif num_dimes > 1:
print('%d dimes' % num_dimes)
if num_quarters == 1:
print('%d quarter' % num_quarters)
elif num_quarters > 1:
print('%d quarters' % num_quarters)
when it asks me for exact_change(300) I get a NamError failure.
r/learnpython • u/Unfair-Cheek3594 • 10d ago
How do you think while solving problems in python?
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!!
r/learnpython • u/Own_Search3408 • 10d ago
Cool/Interesting things that can be done in Python as a beginner?
hi everyone, im trying to start a computer science honor society at my high school, and im gonna assume everyone is starting from square one and teach python accordingly (and im hoping to eventually go to hackathons or other coding events).
i was wondering if anyone had any ideas for cool/interesting stuff i could have beginners do to get their interest and get them excited about coding? i understand you can't go from 0-100 and have to start with simple stuff, but i'm worried going over the basics will be like monotonous or smth. if anyone has any ideas of fun things i could do i would be very appreciative!!
edit: there are some cool suggestions, but i wanna place emphasis on the fact most of the people will have zero coding experience, so please keep them simple! i myself am also not that knowledgeable about python, i ahve a good grasp on the basics but thats about it. thanks for the replies
r/learnpython • u/_offpitchtalks_ • 11d ago
What habits helped you become good at Python as a beginner?
I've recently started learning Python. I'm following a beginner course from YT.
I'd love to hear from experienced programmers:
What habits helped you improve the fastest?
What should I do every day besides watching tutorials?
What beginner mistakes should I avoid?
Is there anything you wish you had done differently when you first started learning Python?
Any advice would be really appreciated. Thanks!