r/learnpython • • Nov 14 '21

URGENT: need to learn python ASAP

Hi all. I used to know some python a couple years ago and don’t remember too much of it. I stupidly volunteered to help a cute girl with coding for her class and now she’s needing help with it. Can someone teach me how to do good python stuff in the next 2 days. I understand for loops and while loops and printing strings and Booleans. Are there any other major things I need to know??? Thank you in advance. I just don’t wanna look stupid in front of her cuz I really like her and want to be helpful.

0 Upvotes

27 comments sorted by

View all comments

1

u/QuestionabIeAdvice Nov 14 '21

With the basic methods already included, lists and dictionaries are pretty powerful. Learning more about their many uses is a good start. Start with the basic methods. Like iteration, slicing, indexing, other built-in functions like len and zip are also useful. List and dictionary comprehensions are a good way to impress a beginner.

Learning about all of the build-in methods for the objects in the default library should be sufficient for most needs.

String manipulation is also useful. For simple string formatting the recently added f-strings make for a more pleasant code-reading experience. Learn how to cast a string to an integer or vice versa. Learn how to capitalize a string, or strip it of unwanted characters.

If you don’t want to look up the documentation running dir(object) will print a list of all the methods. Then use help(object.method) to print out relevant helpful comments if any can be found. Once you’re finished with all that reply with a copy of your work and I’ll give you more stuff to learn.