• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/25

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

25 Cards in this Set

  • Front
  • Back

Value

Letter or a number


That a program manipulates

A data type is a category for a value. Types of datatypes

-Integer (number)


-Floating point (number with a decimal point 2.00 or 02.000)


-Strings (uses quotation marks"")

If you are not sure what type a value is type into interpreter:

Print (type("Hello world"))



Or different value

What happen when we type print(1,000,000)

Firs semantic error because python will interpret 1,000,000 as comma separated list of three integers, result: 1 0 0

Variable

Is a name that refers to a value.


(one of the most powerful features in a programming language is to manipulate variables)

Variables name

- Can contain number and letters


- variable name can't start with a number


- for convenience it doesn't start with a capital letter


- can contain underscores (martin_matejka)


- can't contain special signs(like $ etc. )


- variable cannot be a Python keyword

If we give variable a illegal name we will get a:

Syntax error

Python keywords a-c

and


assert


break


class


continue

Python keyword d-e

def


del


elif


else


except


exec

Python keyword e-g

exec


finally


for


from


global

Python keyword i-l

if


import


in


is


lambda

Python keyword n-r

not


or


pass


print


raise

Python keyword r-y

return


try


while


yield

What creates new variables and gives them values

Assignment statement


For example:


bacon = 2,13

What creates new variables and gives them values

Assignment statement (variable name, equal statement and value)


For example:


bacon = 2,13

Statements

Is a section of a code that represents a command or a action: assignment statement or print statement

Result of a print statement

Value


Print (5)


5

Expressions

Expression is a combination of values variables and operators

Expressions

Expression is a combination of values variables and operators


Not every expression contains all of three. A value by it self is considered as expression and so variable

Expressions


>>>1 + 1


2


>>>2


2

Expression is a combination of values variables and operators

Expressions

Expression is a combination of values variables and operators


A expression can be a variable or a value by it self

Expressions

Expression is a combination of values variables and operators

Expressions

Expression is a combination of values, variables and operators


Or just a variable or value it self


>>>1 + 1


2


>>>2


2

Python code style

PEP8

Good variable name

Describes the data it contains