Python Language Reference Flashcards

1
Q

print()

A

Print “ “ takes whatever inputs or str you put in it then prints it out in your program.

ex. print “Hello world.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

print()

A

Print “ “ takes whatever inputs or str you put in it then prints it out in your program.

ex. print “Hello world.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

python (program).py

A

This is how you run a python program from command prompt or powershell. First you type in python, then the name of the program ( which you need to be in the right directory) then .py and this runs the program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

#

A

Hash tag (octothorpe) this comments string to explain a section of code, also useful for disabling lines of code when necessary.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Operators

A

used for math in code mainly but have other uses also (+ - * / % < > <= >=)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

+

A

Plus / addition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

-

A

minus / subtraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

/

A

forward slash / division

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

*

A

asterisk / multiplication

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

%

A

percent / modulus

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

>

A

greater than

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

<=

A

less than equal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

> =

A

greater than equal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Variables

A

variables are nothing but reserved memory allocations to store values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

floating point

A

are numbers represetnted in computer hardward as base 2 binary functions

ex. 1.0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

=

A

assigns a value on the right to a value on the left

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

==

A

test’s if two things has the same value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Format string

A

python uses c style string formatting. % operator is used to format a set of variables enclosed in a “tuple” (fixed sized list) string can be prints, saved to files, sent to servers, etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

%c

A

character string

20
Q

%d

A

signed decimal string

21
Q

%s

A

string conversion of str() prior to formatting

22
Q

%f

A

floating number

23
Q

%r

A

raw string; suppresses actual meaning of escape characters.

24
Q

( example, example )

A

parenthesis, multiple variables go in them, separated by commas.

25
Q

python (program).py

A

This is how you run a python program from command prompt or powershell. First you type in python, then the name of the program ( which you need to be in the right directory) then .py and this runs the program.

26
Q

#

A

Hash tag (octothorpe) this comments string to explain a section of code, also useful for disabling lines of code when necessary.

27
Q

Operators

A

used for math in code mainly but have other uses also (+ - * / % < > <= >=)

28
Q

+

A

Plus / addition

29
Q

-

A

minus / subtraction

30
Q

/

A

forward slash / division

31
Q

*

A

asterisk / multiplication

32
Q

%

A

percent / modulus

33
Q

<

A

Less than

34
Q

>

A

greater than

35
Q

<=

A

less than equal

36
Q

> =

A

greater than equal

37
Q

Variables

A

variables are nothing but reserved memory allocations to store values

38
Q

floating point

A

are numbers represetnted in computer hardward as base 2 binary functions

ex. 1.0

39
Q

=

A

assigns a value on the right to a value on the left

40
Q

==

A

test’s if two things has the same value

41
Q

Format string

A

python uses c style string formatting. % operator is used to format a set of variables enclosed in a “tuple” (fixed sized list) string can be prints, saved to files, sent to servers, etc.

42
Q

%c

A

character string

43
Q

%d

A

signed decimal string

44
Q

%s

A

string conversion of str() prior to formatting

45
Q

%f

A

floating number

46
Q

%r

A

raw string; suppresses actual meaning of escape characters.

47
Q

( example, example )

A

parenthesis, multiple variables go in them, separated by commas.