Sat 01 April 2017 PY-Prelim Dans «py-intro» par Ed Rantanen Getting setup: A couple of things before we begin to code. Python https://www.python.org/downloads A work area https://www.jetbrains.com/pycharm/ Test: After downloads are accomplished Make a project in pycharm. Add a python file Look at the example example: test 1 Run example code. ("green …
Sat 01 April 2017 PY-Into 1 Dans «py-intro» par Ed Rantanen python Why use python? it's is open source it was created by Guido Van Rossum It has a ton of modules It was some crazy software built with it such as blender or flask and for more background its wiki is @ Python python shell From a terminal windows type "Python …
Sat 01 April 2017 PY-Into 2 Dans «py-intro» par Ed Rantanen comments pound sign 3 back ticks example of comments: example: comments variables bag_full_of_candy = 5 box = bag_full_of_candy * 5 x = 2 y = 4 data structures tuple : position =(x,y) list : routes = [] routes.append(position) Note: Latitude is "0" at equator, "90" north pole / "-90" at south pole dictionary : fisheries_area = {} fisheries_area["cod"] = (x …
Sat 01 April 2017 PY-Into 3 Dans «py-intro» par Ed Rantanen strings Python has some really interesting tools to work with strings strings are groups of letters and/or numbers blah = "Beam Me Up, Scotty" blah[0] blah[:3] blah[:-2] blah[::-1] The -1 syntax is quite interesting, try it in the python shell. What is the result? Doing a …
Sat 01 April 2017 PY-Into 4 Dans «py-intro» par Ed Rantanen for loops Lets start with a "for" loop, you can think of this as number of revolutions; if only one number is used such as 10 as a static number it is very limiting. for elm in range(10): res = elm * 2 print(res) A for loop using a single …
Sat 01 April 2017 PY-Into 5 Dans «py-intro» par Ed Rantanen getopt getopt is a library for utilizing command line options. By adding arguments we can extend simple static variables. As we have worked with Pythagorean expression, all the variables have been static in nature now with we can make a utility that that will take any combination of numbers. simple …
Sat 01 April 2017 PY-Into 6 Dans «py-intro» par Ed Rantanen Functions A function, What is it? It is away to create re-usable code; something you might use more than once or away of creating blocks of code that are more easily read. As an example: A Math function A print statement From lesson 1 we saw c = a**2 + b …
Sat 01 April 2017 PY-Into 7 Dans «py-intro» par Ed Rantanen newspaper newspaper is library that we will use to pull data from media sites. Follow the link, read and try the intro examples. newspaper With this library we will be pulling the data in to a variable for parsing (searching) that will later be analyzed for some criteria. Now that …