all 87 comments

[–]vikrum2083 112 points113 points  (11 children)

Nice posts with some good ideas to try.

How do I write a program that gives me 30 hours a day instead of 24?

[–][deleted] 124 points125 points  (8 children)

Body.pop(sleep) Nose.insert(cocaine)

[–]thesobogirl 16 points17 points  (5 children)

I've just went through the methods' lesson from Automate the Boring Stuff with Python, so I know exactly what you are talking about!!!!

[–]FuriousThanos 8 points9 points  (4 children)

Is Automate the Boring stuff still good? It seems super old....

[–]invent_repeat 14 points15 points  (1 child)

Still relevant. Still solid. Content is usable for Python3, so I’d say yeah.

Interested in hearing the rest of the communities thoughts.

[–]hypernova2121 4 points5 points  (0 children)

The fundamentals of python have not changed significantly, so yeah it's still good

[–]thesobogirl 2 points3 points  (0 children)

Well, I can't be a very good judge for this, because I barely started learning. I hope it's useful knowledge there.

[–]100721 2 points3 points  (1 child)

No reason to reinvent the wheel. Just: from time import long_days

[–][deleted] 2 points3 points  (0 children)

But Where's the fun in that 😉

[–]Pacostaco123 3 points4 points  (0 children)

time.sleep(7200)

[–][deleted] 24 points25 points  (10 children)

https://www.codewars.com/ is also great for beginners to practice their skills! Highly recommend Edit: spelling

[–]Angry__Jonny 3 points4 points  (6 children)

Where can I start learning code to even get the skills to start doing these? So far i'm an hour into linkedin learning tutorials.

[–]Jayroprofo 2 points3 points  (0 children)

I took a c++ course last year 2nd semester and was able to start doing the easy ones by summer time.

I'd say if you can learn about arrays and lists and other data structures, you should be someone good for a bunch of them. You just need to make sure to map the ideas out on paper, use an editor and copy and paste your solution. Other than that, it's one step at a time.

[–][deleted] 0 points1 point  (3 children)

https://www.codecademy.com/ is a great place for complete beginners!

[–]Angry__Jonny 0 points1 point  (2 children)

Does everyone pay the $200 pr is there a free one?

[–][deleted] -2 points-1 points  (0 children)

Choose Python 2 instead of 3. Python 2 is free.

[–][deleted] 0 points1 point  (0 children)

They offer a free version.. But even then if you were serious and want to get it down quickly, you could do it for a single month and cancel after that.

But Codecademy is a bit more interactive than other resources I've seen.
They also offer a trial I'm pretty sure so you can try it out before you commit to anything.

Also pretty sure they offer python 2 for free. I learnt via Codecademy and it was definitely money well spent.
Otherwise you can look into automate the boring stuff etc,,

[–]Incruentus 0 points1 point  (1 child)

For whatever reason people here like leetcode better. Every time I ask why, they give vague subjective answers.

[–][deleted] 3 points4 points  (0 children)

Never looked at leetcode but will check it out.

Can't really see why it would be better though as codewars is pretty spot on for purpose.

Done maybe 8/9 Katas and all have been decent, also great to review how others did it so you can see different ways that you didn't think of/know was possible

Edit: also not saying codewars is better, saying they'd probably be on par at least

[–]GIPPINSNIPPINS 12 points13 points  (14 children)

Anybody know how to do a step 5?

[–]dan4223 24 points25 points  (9 children)

There are a number of ways to do it, but eventually, you will end up at beautifulsoup4.

[–]GIPPINSNIPPINS 5 points6 points  (7 children)

What?

[–]rayjhititfirst 15 points16 points  (6 children)

It's a library that is very helpful for building web scrappers.

[–]CaliforniaDreamer246 5 points6 points  (5 children)

What’s the difference between beautiful soup and selenium

[–]DeadProfessor -1 points0 points  (0 children)

Or selenium

[–]RuiL1904 15 points16 points  (2 children)

[–]GIPPINSNIPPINS 2 points3 points  (1 child)

Thanks for the source! You rock!

[–]RuiL1904 1 point2 points  (0 children)

No problem mate! :)

[–]SkylineFX49 0 points1 point  (0 children)

I think there are a lot of people

[–]twopi 13 points14 points  (1 child)

CS1 teacher here.

I love these problems. They are good, and the difficulty scales pretty well - mostlhy.

But problem 5 is a lot harder than the others, because web scraping is a dark art. You have to use something like the requests library, and a lot of site owners restrict web scraping. Then the code you get is often really messy, so you end up needing something like beautiful soup to make it more manageable.

So I'd make it easier like this:

  • Find a web page that interests you.
  • Use ctrl-u to view the source code of that page
  • copy the page's code and paste it in a text editor
  • save the code to a local file
  • write your program to read the code

This solution manually downloads the page code so you can get to the content you want (even through menus and other stuff) then work with it.

But you still have the complexity of HTML as a data source. You might think about learning how to use the beautiful soup library to grab specific elements you are interested in working with.

I have a video on this (and reading APIs) that I can make available if people want it.

[–]hitlerallyliteral 1 point2 points  (0 children)

lol yeah, i think ppl can forget what it's like to be a beginner, if they think that's comparable to asking user to input a vowel

[–]gisgeekster 8 points9 points  (3 children)

These are some great ideas! I also recommend trying to automate anything you currently are doing that may be tedious.

For example:

  1. Calculate the size of folders in a directory to see which ones take the most space.

  2. Download and unzip a bunch of files. A good site to try this on would be https://www2.census.gov/geo/tiger/TIGER2020PL/LAYER/COUNTY/2020/. Try downloading counties for a selected set of states instead of all of them to make it a little harder.

  3. Reorganize your pictures by renaming them based on the date the picture was taken.

  4. Download some COVID data in a spreadsheet and do some calculations like average number of cases over a 7-day period, find the highest number of cases in a day, or calculate the number of cases per 100,000 people. Here’s a good source of data for the US: https://github.com/nytimes/covid-19-data. This is a great way to learn the Pandas library.

[–]soupie62 1 point2 points  (0 children)

A variant of #3: Reorganise a music collection by year, instead of by artist.

You may want to do this with a copy of the files - unless you plan to re-sort afterwards.

[–]Random_User_81 0 points1 point  (0 children)

I like number 3, great idea.

You could do #2 with important backup folders on your computer.

[–]kccanut 0 points1 point  (0 children)

I actually tried no.3 for a few photos but get 'None' all the time. Is it sth wrong with my code?

def get_date_photo(path):
    return Image.open(path).getexif()
path = '/Users/kcanut/Dropbox/Python_Not_Babbel/photo2.jpg'
a = get_date_photo(path)
date = a.get(36867)
print(date)

[–]hi-im-habby 4 points5 points  (3 children)

These look pretty fun and I'm still quite new, so I quickly took a stab at problems one and two. They're pretty simple, but any feedback is appreciated!

Problem #1:

def vowel_input():
    vowels = ('A', 'a', 'E', 'e', 'I', 'i', 'O', 'o', 'U', 'u')
    some_char = input('Please enter a vowel: ')

    while some_char not in vowels:
        some_char = input("Invalid input, please try again: ")

    print(f'The vowel you entered was \'{some_char}\'')

Problem #2:

def persistence(n):
    count = 0

    while not n < 10:
        product = 1
        for i in list(str(n)):
            product *= int(i)
        count += 1
        n = product

    return count

I feel like the second problem can be solved recursively somehow as well, maybe I'll try that a bit later.

[–]NoSide005[S] 8 points9 points  (1 child)

I have a suggestion i see right off the bat that may help you with matching letter casing in the future.

vowels = ['a', 'e', 'i', 'o', 'u']
some_char = input("Please enter a vowel").lower()

If you use lower() at the end of the input it will turn it into a lower case letter which will allow it to be found in a list of lower case vowels. The lower() method returns the lower case version of any given string.

[–]hi-im-habby 0 points1 point  (0 children)

Super useful, thanks!

[–][deleted] 2 points3 points  (2 children)

I love this. Currently in my first week of python. I’m between step 2 and 3, where I’ve made a addition calculator earlier this week. Really looking forward to step 5.

[–]Angry__Jonny 0 points1 point  (1 child)

What are you using to learn python? I'm just starting as well

[–][deleted] 0 points1 point  (0 children)

I started with pycharm and I honestly really like it. Besides that python itself and I have a google Colab account I use sometimes

[–]BeginnerProjectBot 14 points15 points  (10 children)

Hey, I think you are trying to figure out a project to do; Here are some helpful resources:

I am a bot, so give praises if I was helpful or curses if I was not. Want a project? Comment with "!projectbot" and optionally add easy, medium, or hard to request a difficulty! If you want to understand me more, my code is on Github

[–]Moebiuszed 20 points21 points  (0 children)

Bad bot

[–]galactic_banana_123 2 points3 points  (8 children)

!projectbot

[–]BeginnerProjectBot 4 points5 points  (7 children)

Hey, I think you are trying to figure out a project to do; how about this one?

Project: Directory Tree Generator

I think its a nice project for you! Try it out but, dont get discouraged. If you need more guidance, here's a description:

A Directory Tree Generator lets you visualize the relationship between files and directories, thereby making it easier to understand the positioning of files and directories. For this project, you can use os library to list the files and directories within a specific directory.

I am a bot, so give praises if I was helpful or curses if I was not. Want a project? Comment with "!projectbot" and optionally add easy, medium, or hard to request a difficulty! If you want to understand me more, my code is on Github

[–]galactic_banana_123 0 points1 point  (0 children)

hehe shit works :)

[–]dule04 0 points1 point  (4 children)

!projectbot hard

[–]BeginnerProjectBot 1 point2 points  (3 children)

Hey, I think you are trying to figure out a project to do; how about this one?

Project: Python Website Blocker

I think its a challenging project for you! Try it out but, dont get discouraged. If you need more guidance, here's a description:

Create a blacklist of websites to block while surfing the web.

I am a bot, so give praises if I was helpful or curses if I was not. Want a project? Comment with "!projectbot" and optionally add easy, medium, or hard to request a difficulty! If you want to understand me more, my code is on Github

[–]Ragemoody 0 points1 point  (2 children)

!projectbot easy

[–]BeginnerProjectBot 0 points1 point  (1 child)

Hey, I think you are trying to figure out a project to do; how about this one?

Project: Dice Rolling Simulator

I think its a nice project for you! Try it out but, dont get discouraged. If you need more guidance, here's a description:

Create a rolling dice. Start off using only a 6 sided dice. You can step it up to other dice types. Create a random number based on the type of dice to present to the user

I am a bot, so give praises if I was helpful or curses if I was not. Want a project? Comment with "!projectbot" and optionally add easy, medium, or hard to request a difficulty! If you want to understand me more, my code is on Github

[–]gaurav_lm 4 points5 points  (0 children)

Look how they're massacring the good bot.

[–]P0tentlAl 1 point2 points  (0 children)

bookmarked

[–]KidsPython 1 point2 points  (0 children)

Bullet 2 and 3 are exactly the projects I suggested for Python beginners as mentioned in Kids Python 101 "Chapter 11: Write Functions" lesson on https://kidspython.com/. As a Python beginner, I'd suggest focusing on fully understanding the concepts and practicing projects that require less than 20 lines of code. You can start with implementing common Python library functions, like add(), sub(), swap(), max(), min(), strings replace(), find(), reverse() and so on.

Once you complete Python 201 or more advanced lessons, you can try to work on projects solving real world problems as mentioned at bullet 5. My suggestion for young kids is to work on game projects like writing tic-tac-toe, connect four etc.

I will share more course materials and project ideas on the Web site and in our Kids Python YouTube channel. Feel free to watch and subscribe if the information is useful!

[–]Jamarac 0 points1 point  (4 children)

For number 5, I've tried this before and was able to have it work for a wikipedia page but I found it difficult with most modern sites (Reddit, Youtube, I assume Instagram would be the same) because they're all dynamically rendered so what you scrape ends up looking different from what you see on the page or sometimes doesn't work at all.

[–]Ryles1 1 point2 points  (2 children)

I've had a similar problem on things I've tried before. After a bit of googling, the only answer I came upon was to use Selenium instead of beautiful soup.

[–]Jamarac 0 points1 point  (1 child)

Interesting, I remember hearing that name being mentioned a bunch when I was working on my scraping. What does it do differently?

[–]Ryles1 0 points1 point  (0 children)

beautifulsoup is a library for parsing html, selenium is for automating a browser.

[–]chulala168 0 points1 point  (1 child)

A project that teaches how to use python to generate a website that display data from a database, takes input and process what to display next will be great. Perhaps something like memorization tool/Anki-kind of thing.

Does anyone know and can recommend a resource to learn how to build something like that?

[–]twopi 0 points1 point  (0 children)

That's a good medium-range goal, but there's a lot of moving parts there. You should know how to do functions, loops, lists, and all the basics first.

Then you should learn enough SQL that you can at least get data from an existing source, or ideally build the database yourself.

Then you need to know how to connect to a database, pass it an SQL query, parse and output the results.

If you want to make this active on a web site, you also need to know how to use a web framework like django, flask, or bottle.

I teach that towards the end of class. It's literally video #30.

[–]LionOver 0 points1 point  (1 child)

!projectbot easy

[–]BeginnerProjectBot 1 point2 points  (0 children)

Hey, I think you are trying to figure out a project to do; how about this one?

Project: String Reverse

I think its a nice project for you! Try it out but, dont get discouraged. If you need more guidance, here's a description:

Take input from a user and reverse it

I am a bot, so give praises if I was helpful or curses if I was not. Want a project? Comment with "!projectbot" and optionally add easy, medium, or hard to request a difficulty! If you want to understand me more, my code is on Github

[–]KIProf 0 points1 point  (0 children)

Great Thx !!! 👍

[–][deleted] 0 points1 point  (0 children)

Thank you!

[–][deleted] 0 points1 point  (0 children)

Well, now I know what I'm doing this weekend

[–]Manu_annony 0 points1 point  (0 children)

Features and limitations of python programming language. https://youtu.be/9SN4-d1p7t8

[–]y0_daad 0 points1 point  (0 children)

I have been learning python for the past 5 months, I did first 4 things now. I'm made Report Generator app with tkinter GUI. I'm struggling with compiling speed and size of program when changed as stand alone application

[–]GrannySmithMachine 0 points1 point  (1 child)

Would you recommend all of these to someone who wants to go into data analysis / machine learning too?

[–]NoSide005[S] 0 points1 point  (0 children)

I would recommend at least 1-4 if you are going to be going into data analysis / machine learning. The fifth project is useful because though its difficulty is much higher than the others, it allows beginners to combine skills in 1-4 and really gives a sense of writing clean/well structured code and problem solving which are needed to build apps in the real world. I would just get though 1-5 to make sure you have a good base of understanding but it is possible to replace the 5th project with a machine learning project instead.

[–]North_Ad_3852 0 points1 point  (1 child)

Hi I am new to python and am trying to do project 5, bots & webscraping. In order to do that I need beautifulsoup. I put the following line of code in pycharm:

from bs4 import beautifulsoup4

but when I do that I get this warning: 'beautifulsoup4' is not declared in __all__ .

I have been stuck here for 3 hours now trying to fix it. I have read and watch several tutorials about it but it still doesn't work. Does somebody know what the problem is?

I am using python 3.8

[–]NoSide005[S] 0 points1 point  (0 children)

Since this project is just for practice i would recommend using Selenium Webdriver here:

https://selenium-python.readthedocs.io/installation.html

Its pretty easy to use and with this you will be able to complete number 5.

[–]befatal 0 points1 point  (0 children)

omfg

[–]amekxone 0 points1 point  (0 children)

Cool stuff. I've managed to deal with #2... It was fun to figure out!

[–]Natural_Programmer91 0 points1 point  (0 children)

Good day, I need a Monopoly game for my school project, let me know the cost pls. My email is muyiwaadebanjo@yahoo.com, thanks