Python Notes
My notes after my first python assignment.
Home | Python | Bash | More Python | Link 4 (TBD) |
Python Learns
Also in the QnA w/Python post.
I’ve had very little experience with Python before I used it so here’s some of the new functionality I learned and the syntax for it.
Code | Syntax | Notes |
---|---|---|
Variables | key = value | Unlike Java, it looks like Python doesn’t really use variable assignments like java. Instead variables can just be assigned “any” and then can be assigned numbers, letters, strings or pretty much watever other value you want including lists. |
Functions | def function_name(parameter1, parameter2, parameterX): code return value | Functions are pretty similar to other languages for the most part. It is a little different than java in that you don’t really use keywords before to define it like int, string or void for the return type or static, private and public. They still function (get it?) pretty much the same though. |
For loops | for newVar in definedVar: code | For loops are probably the most different from Java. This is because they go through a list of a variable instead of creating a new integer and going until that integer reaches a value. That interger is suprisingly useful, so to me it seems like this change removes some of the functionality of a for loop. Despite this though I still found ways around it and was able to accomplish my goals. |