64

Python Basics - Alessio Vaccaro · ProJect v Module untitSed0.py 1. py .py untitSed3.py unt&d4.py tnt&d5.py temp-py I import matplotlib.pyplot as pit import numpy as np np. random

  • Upload
    others

  • View
    24

  • Download
    0

Embed Size (px)

Citation preview

• 1 2 3 100 13151 0

• 1.5 2.048128 3.000001

• "Hi! I’m Alessio Vaccaro"

• [1, 2, 7, 10]

• (1, 2, 7, 10)

• { "age":"28", "hair":"none" }

• True False

11

type() integer

string my_string

string [x]

string [:x] [x:]

type()

list my_list 1 2 3

[x]

list dictionary

append() list

list[x]

list[x] = value

list tuple list tuple

my_dict dictionary

values keys

“name” “Alessio”“age” 28

value dictionary key

keys dictionary

keys dictionary

keys() keys dictionary

if

if hot:open_the_window

if BOOLEAN_EXPRESSION:STATEMENT

if valueToCheck 22

valueToCheck > 22 True

if True False

if-else

if-elif-else

forlist for

for list listOfNumbers

range()

for list range()

range()

while BOOLEAN_EXPRESSION True

while BOOLEAN_EXPRESSION:STATEMENT

while

number = number - 1

function

function

def my_function(argument1):

do_something_with_my_argument1

return(result)

function

module functions

module library

module “time” functions

math module

sin function math module

module “math”

math.pi math.sin()

pi math sin()

Functions attributes

module “random”

rand.int() function

attribute/function module

dir() function