Python Flashcards

1
Q

how is string presented

A

it is the text, and always it between quotation marks

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

how are integers presented

A

they are the numbers, without quotation marks

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

what is the print function

A

it outputs information

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

mathematical operations

A

add: 2+2
subtract: 2-2
multiply: 2*2
divide: 2/2

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

what separates integers and strings

A

COMMAS

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

what does /n do

A

it separates the code

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

variable names

A

cant have spaces, and cant start with #, can have capital letters, and _

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

to input info:

A

you have to write a variable= input (“write your name: “)

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

use the plus signs

A

to combine string and variable or variable with variable

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

convert input to integer

A

var1= int(input(“enter a number”)
var2= int(input(“enter a number”)
print(var1+var2)

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

to measure length of a string:

A

name= “thereza”
length=len(name)
print(length)

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

why do we use # in python

A

to add comments

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

python operators

> <
!=
=
<=

A

equal to
greater than
less than
not equal to
greater then or equal to
less then or equal to

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

if statements

A

if, elif, else

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