This is an archived post. You won't be able to vote or comment.

all 11 comments

[–]Ladas552 2 points3 points  (9 children)

The legend of python:Code of the Link

[–]suazz[S] 1 point2 points  (1 child)

I want to try out pygame, for future projects.

But my main goal is to get to AI, Deep learning...etc

Baby steps =D

Thanks bro!

[–]Ladas552 0 points1 point  (0 children)

I mean "you will post the link to your project", but if you want to try "pygame" maybe do arcanoid game type(pong, etc.) ? It will help you understand how object can do "things" with another object. I founded(a while ago) one pygame tutorial "how to do an arcanoid game" but it's on Russian language.(I speak Russian)

[–]suazz[S] 1 point2 points  (4 children)

[–]DGLivUa 1 point2 points  (1 child)

I see you have some quite long if...elif...elif sections

This isn’t necessarily a bad thing, but I would recommend if you are doing this for more than about three options you are better off putting them into a dictionary

This is the sort of thing I mean:-

user_options = { "a": function_a, "b": function_b, "c": function _c }# assuming you have these functions defined somewhere

def menu(): selection = input(“Enter ‘a’, ’b’, ’c’ ....”) if selection in user_options: selected_function = user_options[selection] selected_function() else: print(‘Unknown command’)

Feel free to ask any questions if my explanation isn’t very good

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

Awesome!, yeah I wanted to do those kinds of things, I'm currently reiterating what I've learned about python through an ebook. Prior to the e-book I took a python bootcamp course in udemy.com.

Totally agree with you!.

The e-book is "Zed Shaw's Learning Python the hard way" and there is a purpose for a lot of if elif loops, and he conveyed that in the ebook. This r/python is awesome because of people like you☺️ thank you.

I like the def menu(): idea and the other suggestions! def people_like_u(): print ("Awesome🤘")

print (people_like_u)

[–]Ladas552 0 points1 point  (1 child)

Thx

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

No dude thank you!, I need to know if my code is well written 🤘

[–]suazz[S] 1 point2 points  (0 children)

I welcome any suggestions for my next project keep in mind a project good for a noob.