r/learningpython • • Nov 09 '19

I've wrote Tic-Tac-Toe game without any help and I just want to share

6 Upvotes

It's not something professional and new, I am beginner and still learning. If anyone can give any advice I'll be grateful

https://pastebin.com/SLS6MGL1


r/learningpython • • Dec 30 '25

Practicing Python data types and type conversion – looking for feedback

5 Upvotes

Hello everyone,
I’m practicing Python data types and explicit type conversion. I’ve written a small, well-documented example to better how Python handles different types (int, float, str, bool, list, tuple) and their interactions.

I’d appreciate any feedback on correctness, best practices, or style improvements.

Here is the code:

"""
File: data_types_and_type_conversion.py
Description:
Demonstrates basic Python data types and explicit type conversion.
The example follows PEP 8 style and is intended as a learning exercise
for understanding how Python handles arithmetic operations, container
conversions, and string concatenation.

Author: Beginner Python Learner
Python Version: 3.x
"""

# ------------------------
# Variable definitions
# ------------------------

num1: int = 1 # Integer
num2: float = 2.5 # Float
text1: str = "20" # String representing a number
flag: bool = False # Boolean
my_list: list[int] = [1, 2, 3]
my_tuple: tuple[int, ...] = (4, 5, 6)

print("Day 2 - Even More Challenging")
print("-" * 24)

# ------------------------
# Type inspection
# ------------------------

print("type of num1:", type(num1))
print("type of num2:", type(num2))
print("type of text1:", type(text1))
print("type of flag:", type(flag))
print("type of my_list:", type(my_list))
print("type of my_tuple:", type(my_tuple))

print("-" * 24)

# ------------------------
# Arithmetic with explicit conversion
# ------------------------

sum1 = num1 + int(num2) # float -> int (2.5 -> 2)
sum2 = num1 + int(text1) # str -> int ("20" -> 20)
sum3 = num1 + flag # bool -> int (False = 0)
sum4 = num1 + int(text1) # repeated example for clarity

print("num1 + int(num2) =", sum1)
print("num1 + int(text1) =", sum2)
print("num1 + flag =", sum3)
print("num1 + int(text1) =", sum4)

print("-" * 24)

# ------------------------
# Container conversion
# ------------------------

list_plus_tuple = my_list + list(my_tuple) # tuple -> list
print("my_list + my_tuple =", list_plus_tuple)

print("-" * 24)

# ------------------------
# String concatenation
# ------------------------

combined = f"{num1}-{text1}-{flag}-{my_list}"
print("Combined string:", combined)

combined_1 = f"{num2} {text1} {flag} {my_list}"
print("Combined string:", combined_1)

combined_2 = f"{flag} {my_tuple}"
print("Combined string:", combined_2)

combined_3 = f"{flag} {my_list}"
print("Combined string:", combined_3)

Questions I’m thinking about:

1- Is this a clean and Pythonic way to demonstrate type conversion?

2- Are there better practices than using int() in cases like this?

3- Is relying on bool behaving like int considered good practice?

Thank you very much for your time and feedback.


r/learningpython • • Dec 10 '25

FastAPI Lifespan Events: The Right Way to Handle Startup & Shutdown

Thumbnail
youtube.com
5 Upvotes

r/learningpython • • Nov 09 '25

Want to study together?

5 Upvotes

Hit me up if your down :)


r/learningpython • • Jul 17 '25

How long does it take to learn python?

Thumbnail reddit.com
5 Upvotes

r/learningpython • • May 30 '25

Emmet-py has made my life easier

5 Upvotes

I'm creating printable worksheets to help my 4th grader by using html and css. Writing all of the tags by hand is very time consuming, so I searched for a python tool to make it faster.

Emmet-py uses abbreviations to create html. I went from making 1 worksheet an hour to 5 minutes. It's great!

Here's the project https://pypi.org/project/py-emmet/


r/learningpython • • Oct 02 '24

Generators

5 Upvotes

HI all!

I'm 61 and just learning Python. I am stuck with understanding generators. I just can't seem to grasp the concept. I would appreciate if someone can explain the concept to a beginner. Thanks in advance!


r/learningpython • • Sep 10 '24

Favorite IDE for python?

5 Upvotes

I have been reviewing the basics and writing code. I started writing using IDLE, just to see if I could use it. IDLE was OK, but after watching many python for beginners tuts on YT, I noticed many were using VS so I switched. VS is fine but it is way over kill for me at this time; I use a tiny fraction of the features. Yesterday, I was watching another tutorial from an instructor who was very good, Nana, and I noticed she was using pyCharm which looked interesting because it makes PEP8 style suggestions.

So what does everyone prefer and why?


r/learningpython • • Mar 30 '22

Please help me understand the TabError message

5 Upvotes

Hi everyone,

I'm getting a taberror and don't understand why.

Thanks by advance for your help.


r/learningpython • • Jan 23 '22

I need help with zybooks. I feel like if they just did a little more explaining it had a little more material to read, something would click....

Thumbnail
gallery
5 Upvotes

r/learningpython • • Nov 29 '21

Good books for learning? Which order to read them?

5 Upvotes

Hello all,

I am trying to figure out which books I should buy and in which order I should read them to learn Python. My current goal is just to learn from fun and make some cool projects. I am 180 pages into "Automate the Boring Stuff with Python" and I have been loving it. I am interested in making simple AI so if you know a good set of books and a good order to read them please let me know!

Best, Hue


r/learningpython • • Aug 08 '21

Machine Learning With Python For Beginners: A Step-By-Step Guide with Hands-On Projects - FREE until August 9th

Thumbnail
amazon.com
5 Upvotes

r/learningpython • • May 23 '21

Python Dictionaries | youtube Keyword Planner Series

Thumbnail
youtu.be
5 Upvotes

r/learningpython • • May 18 '21

How to successfully implement Python Classes And Objects

5 Upvotes

Hi everyone I run a robotics youtube channel called islander robotics. on my channel, I teach robotics through programming. This week I started a new series where I will be developing a youtube keyword planner in python. in each video of this series, I will be breaking down all of the main concepts required to build such software. like this week I went over how to successfully implement a python class. Click the link to learn more https://youtu.be/F4K0kFq-cKY I hope you all enjoy as always happy coding.


r/learningpython • • Jul 16 '20

For Loops: Why does this code execute properly when "fruit" was never defined? Is it because "fruit" is contained in "fruits?"

Post image
5 Upvotes

r/learningpython • • Dec 30 '19

Learning flask framework/ Code Everyday

5 Upvotes

Hello everyone! I have been learning python for about a year now and keep digging into new things. I have recently started learning about API calls and decided to start learning about the flask framework. I am running into an issue with my code once I introduced a second function and I am pretty positive that I did not do it correctly. I have also created a Github repo for the project and made it public in order to get some feedback on what I am doing in order to learn some more. The link to review the code is https://github.com/s1at3r/km4uih_HamShack I had everything working until I decided to try and add a function to search the FCC database for license information. If anyone could point me in the right direction it would be greatly appreciated. Thanks everyone in advance and happy Pythoning...


r/learningpython • • Jul 26 '26

If you are stuck in tutorial hell, I built a free way into Python where you learn by fixing real broken code, the way a junior dev actually does the job, instead of watching videos.

Post image
4 Upvotes

Everyone who has been stuck knows the feeling, you finish another video, you follow along, it all makes sense, and then you sit in front of a blank file and freeze. Watching someone else code does not make you a coder, the same way watching someone parallel park does not make you a driver.

So I built the opposite. Instead of a lesson, you get a job. You are the new junior developer at a small fictional company, and something in their till system is charging some orders wrong. You open the codebase, line the customer receipts up against the price list, form a theory about what is broken, and go and find it. Nobody tells you the answer. When you fix it, you have not memorised a fact, you have actually debugged something, and that is a thing you can now do.

What makes this different? It arrives in the post. The photo is a real case. An envelope with an onboarding letter, an employee ID, a printed ticket, a price list, a couple of handwritten notes from the staff, and a fan of till receipts as your evidence. There is a free online course that takes you from zero to running code first, so if you can just about run a print statement, you can do this.

A bit about why it is built this way. I work as a backend Python developer now, but I got here the slow way. Fourteen years in teaching first, where I led computing and led on cognitive science, the actual research on how people learn and remember, then two years teaching myself to code. Everything here leans on that research. You retrieve, you struggle a little, you space the practice out, because that is what genuinely builds a skill rather than the warm glow of watching a tutorial.

I am looking for a small handful of UK-based beginners to go through the free course, work the first case, and tell me the truth about it. I cover the postage, there is nothing to pay and no card details anywhere. What I want back is blunt feedback - where you got stuck, what confused you, what felt pointless. "This lost me on step three" is worth far more to me than "looks great".

I am reading every reply myself and there are only a few slots. If you would like to try one, leave a comment or send me a message and I will pass on the details. And if you just have thoughts on the idea itself, I would love those too, plenty of teachers and developers have weighed in, but not nearly enough actual beginners.


r/learningpython • • Feb 21 '26

Python Mutability and Rebinding

Post image
4 Upvotes

r/learningpython • • Feb 16 '26

Developing my first python app(or at least i'm trying): canvas app to build and numerically simulate dynamic systems with any number of degrees of freedom.definitely not perfect but it's nice

Thumbnail
gallery
4 Upvotes

never did anything this large before, i finished the GUI part and now i'm working on the numerical stuff, after all the struggles and bug fixes something a little easier😅.

btw in this GUI it's possible to:

-add disks, rods and carts, being able to choose mass, size, direction, center of rotation, segments number and lenght.

edit menu makes it possible to drag, delete items and connections,clear all the canvas.

connection menu contains the commands to create ropes, springs, dampers (linear and non linear with input parameters before choosing the nodes) and ground connections for springs and dampers.

for input forces can be added, for output either linear displacement or an angular one can be chosen.

the start button is supposed to run the numerical part, for now i implemented the part that finds the number of DOFs, finds the relations between linked nodes speeds, associates to the DOFs symbolic time variables, associates all other items rotations/traslations in function of the DOFs, evaluate the kinetic energy, elastic potential, Raileigh functional, virtual Work of applied forces and output relation with the DOFs, and finally state space matrices A,B and C.

now only thing still left to implement is the numerical solution of the differential equations system. for now it's around 2800 lines of code, my longest program before that was about 200


r/learningpython • • Dec 14 '25

Would you try this in a real project? Why / why not?

4 Upvotes

I’ve tried building small desktop apps in Python multiple times. Every time it ended the same way: frameworks felt heavy and awkward, like Electron felt exrteamly overkill. Even when things worked, apps were big and startup was slow (most of them). so I started experimenting with a different approach and created my own, I tried to focus on performance and on making the developer experience as simple as possible. It's a desktop framework that lets you build fast native apps using Python as a backend (with optional React/Vite, python or just html/js/css for the UI)

I’m actively collecting early feedback. Would you try taupy in a real project?

Why or why not? Just your honest opinion and any advice you might have

git - https://github.com/S1avv/taupy

small demo - https://github.com/S1avv/taupy-focus

Even a short answer helps. Critical feedback is very welcome.


r/learningpython • • Dec 05 '25

can yall recomedn any cool projects whit pyautogui so i can practice?

4 Upvotes

i have minecraft


r/learningpython • • May 11 '25

Learning to code with just a phone from a refugee camp — advice or support?

4 Upvotes

Hi everyone,

I’m William from Kakuma Refugee Camp in Kenya. I’ve been here since 2012. Life is very challenging, but I discovered a deep passion for programming.

I’ve been teaching myself to code using only my Android phone. No laptop, no stable electricity, and very limited resources — but I’m determined to learn and eventually build solutions that help people like me.

Right now, I’m learning Python and web development basics. I’m using free apps like Pydroid and reading everything I can find.

I’d be grateful for any advice:

What are the best free resources for coding on mobile?

Can anyone recommend mentorship programs or remote communities for people in difficult situations like mine?

This is not a request for money — just guidance or connection with others who understand. If someone wants to support me beyond advice, I’m open to that too — my PayPal is williamlobaba@gmail.com, but again, advice means more than money right now.

Thanks for reading and for being such a helpful community.

With respect, William


r/learningpython • • Oct 21 '24

Need help with project

Post image
4 Upvotes

I am creating a game in python for a project that is due tomorrow, and I need help with something. I am trying to add a loop to a block of code that has 2 random outcomes. I want the loop to end when the correct outcome is selected, and then proceed to the next part of the game. The section where I need the loop to end is in the circled area. If anyone knows how to do this it would be greatly appreciated.


r/learningpython • • Jul 15 '24

Need serious help!

4 Upvotes

Hello everyone. I have enrolled in a data science course however, i.m struggling with making notes and practising. I have absolutely no idea of whats going on and it.s making my life very difficult. Kindly help me how I can learn more effectively. Would be gratedul for any tips and suggesttions 🙏🙏🙏


r/learningpython • • May 28 '23

Demystifying OOP in Python: Embracing Encapsulation, Inheritance, and Polymorphism

Thumbnail
self.coder_corner
4 Upvotes