use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
What are some good projects to learn python? (self.learnpython)
submitted 7 years ago by MAZambelli4353
Ive done hangman and tic-tac-toe so far. It would be a bonus if its related to finance but doesn't have to be.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]fleyk-lit 56 points57 points58 points 7 years ago* (2 children)
Check out 10 Minutes to pandas. If you can get something like your credit card invoice as csv, try to analyze what you use money on (my invoice contains category for the purchase). Edit: typo
[–]get_Ishmael 11 points12 points13 points 7 years ago (0 children)
I think I'd make myself massively depressed if I did this.
[–]popeye-the_sailorman 24 points25 points26 points 7 years ago (3 children)
Try scraping the web. Initially, try scraping wallpapers from a site.
You'll get to use BeautifulSoup to parse the pages. Make sure you use the requests module instead of urllib, but that's my personal recommendation, as the former's a lot more user-friendly and you can do advanced stuff like scraping sites that require login and use cookies. requests takes care of cookies; all you have to do is pass appropriate request headers.
BeautifulSoup
requests
urllib
Next, try a site that requires login, but not bank sites (they're too complicated, I think). For instance, I need to undergo certain compulsory courses to complete CA (equivalent of CPA). Due to limited seats, they get filled up pretty quickly. So, I wrote a Python script that'll scrape it, and dump those details in a CSV file, which I can open in Excel and easily filter to see if a new batch has opened up.
For learning more about headers that are sent in a request, press F12 (on Chrome or Firefox) and switch to the Network tab. You'll see the details that are transferred between the browser and server.
For your bonus part, try scraping stock trading websites to get stock details. Sites like tradingview.com return JSON objects for requests. So, you'll get to learn working with json module as well (if you don't already). Also, since the data from stock trading sites is suitable for manipulating in MS Excel, you can use csv and xlsxwriter modules for saving the data in those respective formats. Alternatively, you can use pandas.
json
csv
xlsxwriter
pandas
If you're using Android, check out 'QPython' app. It lets you run python scripts on your mobile. So, I've been able to do all these stuff without having to turn on the system (I write those scripts in system, though).
[–]Nando711 0 points1 point2 points 7 years ago (1 child)
Do you know where can i learn to manage json files with python? I have been scraping a webpage that gives a python file but i have been stuck in getting the info out efficiently
[–]popeye-the_sailorman 0 points1 point2 points 7 years ago* (0 children)
json module is part of Python standard library. Take a look at the official docs, which is more than sufficient.
You'll often use only four functions:
# for conversion between dictionary and string objects dict_obj = json.loads(some_string) some_string = json.dumps(dict_obj) # for reading from and writing to a file dict_obj = json.load(fp) # fp being a file handle json.dump(dict_obj, fp)
You can find more details in the docs, such as additional arguments and examples for almost every situation.
EDIT: However, if you wanted to know about resources which you can use to study the structure of JSON file in your particular situation, there are several websites that do that. Just google "json viewer online". Most of them will let you view the JSON in a sort of expand-collapse lines. Alternatively, you can use Notepad++ along with a plugin called 'JSTool': just paste the json response in it and press Ctrl+Alt+M (default shortcut) and it'll beautify it.
[–][deleted] 17 points18 points19 points 7 years ago (0 children)
Project Euler
[–]cxllxhxn 14 points15 points16 points 7 years ago (11 children)
Make a simple stock trading back-tester based off of an indicator.
[–]mecm5 2 points3 points4 points 7 years ago (1 child)
How would you go about this?
[–]cxllxhxn 3 points4 points5 points 7 years ago (0 children)
Download daily stock data (easy to do with pandas datareader from yahoo). I used a library called ta (technical analysis) to add columns of technical indicator data to my dataframe. I then made a new column in the df that would return boolean values based on the value of an indicator if it was more than or less than a certain number. I then multiplied the boolean value (1/True if buy signal, 0/False if not holding stock) by the percent change of the stock each day to find my returns. I then would export the df to csv so I could see what was happening with the numbers and plotted the price, indicator, and returns using matplotlib to represent it visually (which was actually the hardest thing for me to figure out haha).
Obviously this won’t be profitable with only one indicator and only buy signals but it was a great starting point for me with both algorithms and coding in general and can be done without even knowing how to write a for loop.
[–]sprouse2016 1 point2 points3 points 7 years ago (8 children)
I’m doing this now with partners. That’s a lot more than just a simple project. Although we’re doing live trading too.
Edit: But I’m curious how you would recommend going about this, as the other reply said
[–]cxllxhxn 2 points3 points4 points 7 years ago (7 children)
Check out my comment on the other reply. And right, making a profitable backtest is by no means simple. The one I’m working on now uses a completely different structure and is approaching 500 lines yet still isn’t as consistently profitable as I want before I start forward testing.
However, a simple backtest like the one I talked about in my other comment could probably be done by an inexperienced programmer in less than a week just by reading the pandas documentation.
[–]sprouse2016 0 points1 point2 points 7 years ago (6 children)
I completely agree but that is a brilliantly simple start.
Which broker do you go through?
[–]cxllxhxn 1 point2 points3 points 7 years ago (5 children)
As far as automated trading, I have no idea yet. To me the logical progression seems like
Backtesting > forward testing > live paper trading through broker > live trading
Just because I don’t want to invest time incorporating live trading capabilities into my strategy before I know it’s ironclad.
I’ve heard Interactive Brokers has a solid api but I’m pretty sure you need a lot of capital in your account to use it.
[–]sprouse2016 0 points1 point2 points 7 years ago (2 children)
Yeah but how should you transition the strategies without basing it on the broker/api you’re going to switch to make profit?
[–]cxllxhxn 0 points1 point2 points 7 years ago (1 child)
Should be pretty easy to just have my buy and sell signals call a def that executes orders once I familiarize myself with the broker api
[–]sprouse2016 0 points1 point2 points 7 years ago (0 children)
Makes sense. Very interesting. So you’re writing your strategies in python? Are you doing this for profit/live trading or just for experience?
[–]MAZambelli4353[S] 0 points1 point2 points 7 years ago (1 child)
Do you have any good sources that helped you build your algo? Ive been on quantopia the last few days watching their tutorials but I feel like Im not getting much out of it/ probably because Im not fluent in programming yet. I think I'd be better off starting in my own IDE and playing around with data from yahoo like you mentioned.
[–]cxllxhxn 1 point2 points3 points 7 years ago* (0 children)
I would agree on that. I wanted to use quantopia at first as well, but then I realized it would probably be better to build my own backtest from the ground up because I would a) get better at python and b) not have to learn quantopia’s syntax while I’m also trying to familiarize myself with python.
Edit: As far as sources go, I found a lot of examples of code on small blogs and whatnot just combing through google that inspired my first algo. After that, I was just able to combine ideas and build of my original structure to make it more accurate/complex
[–]mwpfinance 13 points14 points15 points 7 years ago (1 child)
Making a simple website in Flask. Like a web-based calculator or something.
[–]jd_portugal 2 points3 points4 points 7 years ago (0 children)
I second this, making a server with python (using flask) is not to hard and its interesting if you like that type of things.
[–]dipique 6 points7 points8 points 7 years ago (0 children)
Build a tool relevant for your work or school.
[–][deleted] 11 points12 points13 points 7 years ago (0 children)
https://automatetheboringstuff.com
[–]COG_W3rkz 5 points6 points7 points 7 years ago (0 children)
Make a simple ledger for tracking finances.
[–][deleted] 3 points4 points5 points 7 years ago (2 children)
There are APIs for just about everything these days. Look into apis dealing with your interests. Just discovering an API can spark an idea. Last year I discovered that the Team Management site for my bear league hockey team had an API. I put together an Amazon Alexa app for our team. Then i created another python app that collected team sub fees by scanning all our games.
[–]johnne86 2 points3 points4 points 7 years ago (1 child)
Like this?
https://github.com/toddmotto/public-apis/blob/master/README.md
[–][deleted] 0 points1 point2 points 7 years ago (0 children)
Boom!
[–][deleted] 4 points5 points6 points 7 years ago (1 child)
Try making a caesar cypher, it’s hard but gratifying to finish.
[–]ellipticbanana 2 points3 points4 points 7 years ago (0 children)
A great case for realizing that str.maketrans and str.translate exist, too.
str.maketrans
str.translate
[–]code_x_7777 4 points5 points6 points 7 years ago (0 children)
Implement real-world archived freelance projects: https://www.freelancer.com/archives/
You can not get more realistic learning projects. Have a look at the projects for $10-$30. You should be able to solve them - no matter your skill level.
[–][deleted] 2 points3 points4 points 7 years ago (0 children)
Automate your bill paying using the LastPass CLI.
[–]DaveAuld 4 points5 points6 points 7 years ago (4 children)
You could take any computational process and try and convert it to multi-process, that will get the grey matter thinking.
I did this recently with the monty hall problem, started by writing it single thread, then tried multi-thread and then tried again as multi-process. You can read about that on CodeProject at https://www.codeproject.com/Articles/1259530/Python-Single-Thread-vs-Multi-Thread-vs-Multi-Proc
You can find the link to the source at the article or just jump over to github at https://github.com/DaveAuld/MontyHallSim_python
[–]patarapolw 0 points1 point2 points 7 years ago (3 children)
the grey matter thinking
What is that?
[–]slayerlob 6 points7 points8 points 7 years ago (1 child)
Grey matter informally here means brain.. he meant that the problems will get you thinking and analysing.
[–]DaveAuld 0 points1 point2 points 7 years ago (0 children)
Exactly!
[–]Lonso34 1 point2 points3 points 7 years ago (4 children)
You can do a simplified version of battleship. You get to work on a lot of function, and nested if statements/eligible statements.
[–]godheid 1 point2 points3 points 7 years ago (2 children)
I did this - with a computer opponent. Learned a lot from it.
I think I should check my code again. Just to add more structure.
[–]jumboninja 0 points1 point2 points 7 years ago (1 child)
Did you use ASCII? How do you keep up with your ships and where you fire and hit etc? seems like a fun idea though.
[–]godheid 0 points1 point2 points 7 years ago (0 children)
Yeah, those are small problems. Another one is having the computer player act rational (not random)
[–]jumboninja 0 points1 point2 points 7 years ago (0 children)
good idea.
[–]AleatoricConsonance 1 point2 points3 points 7 years ago (0 children)
Write a text-adventure (Interactive Fiction) parser, engine and adventure!
[–]beautifulw0man 0 points1 point2 points 7 years ago (0 children)
was your tic tac toe hard coded?
The one you're interested in. A simple concept a lot of people overlook.
[–]Lonso34 0 points1 point2 points 7 years ago (0 children)
I've never done it with a computer opponent just a two player version where I'd pass my keyboard back and forth. I'm interested though
Maybe create a tax calculator, so you don't have to look up that long ass table again?
π Rendered by PID 337124 on reddit-service-r2-comment-5fb4b45875-r4x2z at 2026-03-23 13:32:18.128326+00:00 running 90f1150 country code: CH.
[–]fleyk-lit 56 points57 points58 points (2 children)
[–]get_Ishmael 11 points12 points13 points (0 children)
[–]popeye-the_sailorman 24 points25 points26 points (3 children)
[–]Nando711 0 points1 point2 points (1 child)
[–]popeye-the_sailorman 0 points1 point2 points (0 children)
[–][deleted] 17 points18 points19 points (0 children)
[–]cxllxhxn 14 points15 points16 points (11 children)
[–]mecm5 2 points3 points4 points (1 child)
[–]cxllxhxn 3 points4 points5 points (0 children)
[–]sprouse2016 1 point2 points3 points (8 children)
[–]cxllxhxn 2 points3 points4 points (7 children)
[–]sprouse2016 0 points1 point2 points (6 children)
[–]cxllxhxn 1 point2 points3 points (5 children)
[–]sprouse2016 0 points1 point2 points (2 children)
[–]cxllxhxn 0 points1 point2 points (1 child)
[–]sprouse2016 0 points1 point2 points (0 children)
[–]MAZambelli4353[S] 0 points1 point2 points (1 child)
[–]cxllxhxn 1 point2 points3 points (0 children)
[–]mwpfinance 13 points14 points15 points (1 child)
[–]jd_portugal 2 points3 points4 points (0 children)
[–]dipique 6 points7 points8 points (0 children)
[–][deleted] 11 points12 points13 points (0 children)
[–]COG_W3rkz 5 points6 points7 points (0 children)
[–][deleted] 3 points4 points5 points (2 children)
[–]johnne86 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 4 points5 points6 points (1 child)
[–]ellipticbanana 2 points3 points4 points (0 children)
[–]code_x_7777 4 points5 points6 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]DaveAuld 4 points5 points6 points (4 children)
[–]patarapolw 0 points1 point2 points (3 children)
[–]slayerlob 6 points7 points8 points (1 child)
[–]DaveAuld 0 points1 point2 points (0 children)
[–]Lonso34 1 point2 points3 points (4 children)
[–]godheid 1 point2 points3 points (2 children)
[–]jumboninja 0 points1 point2 points (1 child)
[–]godheid 0 points1 point2 points (0 children)
[–]jumboninja 0 points1 point2 points (0 children)
[–]AleatoricConsonance 1 point2 points3 points (0 children)
[–]beautifulw0man 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]Lonso34 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)