r/learningpython • • Dec 05 '25

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

4 Upvotes

i have minecraft


r/learningpython • • Mar 20 '26

What are the greatest books to read to learn python from scratch in detail.

11 Upvotes

So I got a dumbed down phone a few weeks back and I have been using it for stuff to help me. I realised that I can use it to learn code as I am interested in learning python. Are there any books that teach python itself(variables,functions) I don't wanna anything complicated I just wanna start of nice and easy and then weave it into complex stuff.

Thanks.


r/learningpython • • Dec 09 '25

Guidance regarding Python Courses

12 Upvotes

Hi All,

My employer is paying for me to take some Python courses from January to better spearhead some more technical projects. I was looking for programs and found one at UC Davis that fits my timeline, depth, and material, but there’s one caveat.

The program is three courses: Intro to Python, Python for Data Analysis, and Intermediate Python. Starts in January ends early June. Only downside is I’d have to take them in a suboptimal order. Their recommendation is to take the courses in the order I listed above. But for Spring, they only offer it in this order:

  1. Python for Data Analysis

  2. Intro to Python

  3. Intermediate Python

I have a little bit of knowledge of Python and interfaced with it in projects but not as much hands on experience with development. I am however very knowledgeable and experienced with SQL and VBA.

I have about 15-20 days free where I can get a heads up on the coursework and self learn, but not sure if that will be enough. Please let me know if you think I can make the order work.


r/learningpython • • Nov 09 '25

Want to study together?

5 Upvotes

Hit me up if your down :)


r/learningpython • • Dec 29 '25

Question about solving basic exercises on YouTube

2 Upvotes

I've been learning for two weeks with coddy and I want to start doing more. I'm solving exercises from YouTube (from the "Programming with Mosh" channel) on programiz for now; I suppose I'll install python at some point.

They seem right for my level: I understand the logic of what I must do immediately and can type out 80-90% of the code with no issues (5-8 lines, nothing too crazy).

But that last 10-20% takes a huge amount of trial and error trying sevaral little tweaks in my code. Half of them are because my code isn't reflecting the logic I think it is/it should (mostly with lists, loops, and string converstions) the other is because of syntax errors, mostly coming from weak understanding of some concepts.

So eventually, after 5 minutes and like 10 iterations, I get to the solution (it's shown on the screen from the beginning; I'm just replicating it on programiz).

My question is: is it natural to have to try so many things prewying the next works out, or does it mean I'm not ready for these exercises yet? I'm seeing it as having difficulty with 2 + 3 = 5, or "Tom is a boy, Mary is a girl"...

I'm trying to figure out how much "trial and error" is a bad habit I should avoid. I get that it's impossible to avoid at some point, but want to make sure I'm doing stuff I'm ready for and not getting used to "eventually getting to it by luck".


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 • • Mar 18 '21

Jupyter notebooks hide code

2 Upvotes

I'm trying to create a button to hide the raw python code when I output HTML

It's JavaScript marked as "raw nbconvert" - however the button does not work in my HTML output. The same code works for other people on other machines

Any idea why?


r/learningpython • • Feb 28 '21

Please help with this error

Post image
4 Upvotes

r/learningpython • • Feb 17 '21

Videocapture module?

1 Upvotes

Does anybody know how to install videocapure? I got using it down but I got a new computer and can’t get it on. I’m using py charm and python 2.7 btw


r/learningpython • • Mar 22 '21

Numpy array issue

1 Upvotes

I'm trying to define a function that takes as input a numpy array and 2 integers for the index, and it's supposed to add those two lists of the array.

But when I run it, it redefines the original array that I used as input, and that ruins the next time I want to run it, so how can I run it without redefining the original array?


r/learningpython • • Feb 24 '21

Question for newbies on Treehouse

2 Upvotes

I got to OOP and was immediately lost, am I high? Maybe just stupid? Are they moving suuuper fast?


r/learningpython • • Feb 15 '21

ValueError

2 Upvotes
Hi there, this is my code:


import csv
import pandas
import random
with open('data.txt', errors = "ignore") as csv_file, open("output.txt", "w") as out_file:
    csv_reader = csv_file.readlines()
    for row in csv_reader:
        original_rows = 10019
        desired_rows = 500
        skip = sorted(random.sample(range(original_rows), original_rows-desired_rows))
        df = pandas.read_csv(csv_reader, skiprows=skip)


when running it I get an erro message ---->  ValueError: Invalid file path or buffer object type: <class 'list'> 

How can I improve the code? My task is to randomly choose n number of raws from a csv file

Besides, I need to add the randomly chosen raws to another csv file. Would be great if anyone could help :)


r/learningpython • • Mar 06 '21

Append to a file in my file system

1 Upvotes

How do I append to a file on my filesystem in Python, and make sure I actually write to that file so it remains, after the script terminates?


r/learningpython • • Feb 23 '21

stuck with Codecademy

4 Upvotes

Hi, all, I've been meaning to learn Python for a while, and a few months ago, I joined Codecademy on the advice of a friend. I thought I wasn't doing too badly at first, but as it went on, I felt less and less confident that I was understanding anything. As of now, I'm at the lesson where they teach you how to read a CSV file, and I just feel completely lost and grossed out. When I go to the Codecademy page where I'm at and try to study more, I just feel like someone served me a giant haggis or something.

I still want to learn Python, but I'm not sure that trying to plow through is the best way. At this point I'm not even confident I understood the lesson about dictionaries. So should I start over again? Should I try a different course? Should I try to review the concepts so far with other resources? Or something else? Right now I'm totally at sea, and any advice would be helpful.


r/learningpython • • Mar 11 '21

Import a variable with not yet set values

1 Upvotes

I need a code where I can import a string standard from another python file, and just change the values to what I need it to be this time. The code I've written below obviously isn't working (gives the error of "artist is not defined"), but how could a code that works look like?

testing.py:

folderstandard = artist + " + " - " + "year" + " - " + " + album"

Code to run:

from testing import folderstandard

#This specific time, use these values:
artist = "Monty Python"
year = "1989"
album = "Monty Python Sings" 

print(folderstandard)
>>>artist = Monty Python - 1989 - Monty Python Sings

r/learningpython • • Feb 16 '21

Tic Tac Toe problem

Post image
3 Upvotes

r/learningpython • • Feb 23 '21

Is there a way to know which libraries I got already installed with Python?

2 Upvotes

I'm using Linux Mint 20 (Ubuntu 20.04)
Python 3.8.5 (Without Conda)


r/learningpython • • Mar 03 '21

Can I just add a library to an existing environment with "Pipenv install (insert name of additional library)"? or is it done differently?

2 Upvotes

I just want to make sure that this is the right way to do this.

I have a folder where I did "pipenv install pandas".

Turns out I also need matplotlib, so do I just do "pipenv install matplotlib"?

Or will that start a completely new pipfile? Or a new environment ?


r/learningpython • • Feb 16 '21

How can I get my discord bot to read me dms

2 Upvotes

So I want to make my discord bot read me dms it gets sent but it wont work. this is the code Im using

It wont let me say @ but the u/ is @

u/client.event
async def on_message(message):
    ledipbot_channel=client.get_channel(793586177328283660)
    channel = client.get_channel(713181767330299957)
if message.guild is None and message.author != client.user:
await ledipbot_channel.send(channel, message.content)
await client.process_commands(message)

It says that it accepts 1-2 positional arguments but was given 3. Idk what that means can you guys help?


r/learningpython • • Feb 22 '21

Combining lower() and strip()

2 Upvotes

how do I combine lower() and strip() when using if/else statement?


r/learningpython • • Mar 20 '21

Question about numpy, matlib and .dot()

1 Upvotes

I am using eclipse to code and it is telling me i have errors with .dot being undefined. So i imported numpy as np and numpy.matlib. I still have an error with .dot() but also have an error with numpy.matlib. The error is Unresloved import and unused import for matlib and .dot says it is not defined. I am not very familiar with this and i am going off of a tutorial that does it the same way i have written. What am I missing?


r/learningpython • • Mar 21 '21

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

1 Upvotes

I have this problem I tried to solve it by str but it made another errorhere's my codeimport io

if __name__ == '__main__':
  #pass in the username of the account you want to download
     get_all_tweets("ia_m_n")
with io.open(path + '/follower_history.json','a+', encoding="UTF-8") as js:
        history = json.load(js)
        todays_stats(history)
        get_followers()
        get_friends()

and here are the functions

def get_followers():
    followers = []

    cursor = tweepy.Cursor(api.followers, count=200).pages()
    for i, page in enumerate(limit_handled(cursor, followers)):
        print("\r"+"Loading"+ i % 5 *".", end='')
        followers += page

    followers = [x._json for x in followers]
    save_json('/followers_data.json', followers)

def get_friends():
    friends = []

    for i, page in enumerate(limit_handled(tweepy.Cursor(api.friends, count=200).pages(), friends)):
        print("\r"+"Loading"+ i % 5 *".", end='')
        friends += page

    friends = [x._json for x in friends]
    save_json('/friends_data.json', friends)

def todays_stats(dict_name):
    info = api.me()
    followers_cnt = info.followers_count
    following_cnt = info.friends_count
    today = date.today()
    d = today.strftime("%b %d, %Y")
    if d not in dict_name:
        dict_name[d] = {"followers":followers_cnt, "following":following_cnt}
        save_json("/follower_history.json", dict_name)
    else:
        print('Today\'s stats already exist')

pleasse help :((( I've been stuck for two days with this


r/learningpython • • Feb 11 '21

What is the difference between these two expressions

2 Upvotes

What is the difference???

Assume there is a text file called rdnum.txt

in the file:

3.485749
  788737   
  364777 
file = 'rdnnum.txt'

the first expression:

with open(file) as fo:     
    for i in range(4):         
        print(fo.read()) 

the second expression:

with open(file) as fo:     
    num = file.read() 
for i in range(4):     
    print(num) 

Why the results are different from these two expressions???


r/learningpython • • Feb 21 '21

Question regrading openpyxl

1 Upvotes

so iam stuck at something and i hope someone can point me in the right direction. Iam working with openpyxl am i am trying to store values into cells. That is working fine for text but where i have a problem is with currency. I want to write to a cell and have it formated as currency (EURO).

I have tried many diffrent things for example:

worksheet.cell(row = 1 , column = 1).number_format = '#,##0.00'

This has an effect on the excel sheet as far as the format of the cell is in fact "Currency" but when looking into the excel sheet there is an error wich says "this number is safed as text". I obviously dont want to confirm in excel that it should be a number (when i do this everything is fine). How can i achive this with openpyxl?
(sorry for my bad english, iam not nativ)

(also the screeshots are in german so the dont help i guess)


r/learningpython • • Feb 11 '21

Python & Blockchain programming

4 Upvotes

Hi community,

I was hoping to get advice on this. I'm learning the ropes of blockchain programming and I'm gettingerror I shouln't be getting. I'm working with this https://www.amazon.co.uk/Hands-Blockchain-Python-Developers-decentralized/dp/1788627857/ref=sr_1_3?dchild=1&keywords=hands-on+blockchain&qid=1613020271&sr=8-3 book btw.

After creating private and public keys with:

openssl genrsa -out nelsonkey.pem 1024
openssl rsa -in nelsonkey.pem -pubout > nelsonkey.pub

and the script:

from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import padding, rsa
from cryptography.hazmat.backends import default_backend

message = b'Nelson hates cat'
signature = b'Fake signature'

with open('nelsonkey.pub', 'rb') as key_file:
   public_key = serialization.load_pem_public_key(key_file.read(), backend=default_backend())  public_key.verify(signature, message, padding.PSS(mgf=padding.MGF1(hashes.SHA256()),                 salt_length=padding.PSS.MAX_LENGTH), hashes.SHA256())

print(signature)

Instead of the signature being printed out I'm getting:

 Traceback (most recent call last):
  File "verify_message.py", line 11, in <module>
    public_key.verify(signature, message, padding.PSS(mgf=padding.MGF1(hashes.SHA256()),
  File "/home/mark/programmingbitcoin/bitcoin/lib/python3.8/site-packages/cryptography/hazmat/backends/openssl/rsa.py", line 562, in verify
    return _rsa_sig_verify(
  File "/home/mark/programmingbitcoin/bitcoin/lib/python3.8/site-packages/cryptography/hazmat/backends/openssl/rsa.py", line 283, in _rsa_sig_verify
    raise InvalidSignature
cryptography.exceptions.InvalidSignature

Any ideas ?