Thursday, December 31, 2015

Day 4


these two programs give me different outputs, why? 


total = 0
for num in range (101):
   total = total + num
   print (total)


total = 0
for num in range (101):
   total = total + num
print (total)


for loop

this is not like a while loop



Range (start, end, step)


Standard library.
Math
Random, etc

import Statement

import module

import random

import sys

use pip to import third party modules

Wednesday, December 30, 2015

Day three Section 2

# this is a comment


Functions are like mini programs ... input() for example is a function, functions have arugments that is the () this is a function because python doesnt do the memory management... that is all handled by the language, python is written in C so  C is what does the memory management and python just knows input()

I can write my own functions.

int(), str(),float() convert values' data type


Flow control statements.




Boolean values - True, False need to be capitalized.


comparison vales
Operator Meaning
== Equal to NOT = which is assignment dont get these confused
!= Not equal to
< Less than
> Greater than
<= Less than or equal to
>= Great than or equal to


Int == str
False

Truthy Falsey
bool()




Boolean operators

and
or
not


Flow control statements
If, Else and Elif statements







Tuesday, December 29, 2015

Day two

Section:1 Python Basics
Quiz 1: just a check in
https://automatetheboringstuff.com/chapter1/
Lecture 2: Basic Terminology
Operator
Operation
Example
Evaluates to...
**
Exponent
2 ** 3
8
%
Modulus/remainder
22 % 8
6
//
Integer division/floored quotient
22 // 8
2
/
Division
22 / 8
2.75
*
Multiplication
3 * 5
15
-
Subtraction
5 - 2
3
+
Addition
2 + 2
4


Lecture 3 Writing our first program.




Lecture 3 really slowed me down.




This line

  • print('You will be ' + str(int(myAge) + 1) + ' in a year.')



My age is a string, then it is turned into an interger... then one is added, then it is turned back into a string to concatenate to be 'you will be (myage +1) in a year.
Looking forward to day three.

Day one 12/28/2015

Automate the boring stuff using Python

https://www.udemy.com/automate/

Section 1 Python Basics
Lecture 1: Get Python installed