r/learnpython • • Mar 22 '23

What do you even code?

I am a beginner to python and all coding. I don't know much. All the recommendations are "code everyday". Practice every day is great but what do I practice? Do I open up an empty IDE and code what? I don't know how to do any projects on my own. Do I just YouTube crap and copy them or what? What do I actually code?

341 Upvotes

107 comments sorted by

View all comments

1

u/OldManActual Mar 22 '23 edited Mar 22 '23

Here is a quick Dice roller I coded up.

Mod it, fix it.

    from random import randint
    def ask_user():
        go_no_go = input("Roll the dice? y/n: ")
        return go_no_go
    
    def roll_dice():
        die_one = randint(1,6)
        die_two = randint(1,6)
        print(f"Die one shows {die_one}")
        print(f"Die two shows {die_two}")
        if die_one == 1 and die_two == 1:
            return "Snake eyes!"
        if die_one + die_two == 7:
            return "Lucky Seven!"
        return die_one + die_two
    
    def main():
        decision = ask_user()if decision and decision == "y":
        print(f"The Dice came up {roll_dice()}")
        if decision and decision == "n":
            print("Good Call, gambling is stupid.")
            exit()
        main()
main()

Start SOMETHING

1

u/TheRNGuy Mar 22 '23

add 4 spacebars to every line.

1

u/OldManActual Mar 22 '23

Took too much formatting but thanks!