Conditionals and Controll Flow Flashcards

1
Q

How else if statement is composed in Python

A

if answer == “left” or answer == “l”:
print “This is the “
elif answer == “right” or answer == “r”:
print “Of course this is the Argument Room,”
else:
print “You didn’t pick left or right! Try again.”

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

How Python comparators look like

A

==, !=, , =

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

How power (2^2) is signed in Python.

A

22 and Python can eaven do that with fractions 160.5

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

What is an outcome of doing 3>5. What is a type of that expresion

A

False (bool)

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

How single line comment look like in Python

A
#Comment
print "Not a comment"
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How multiple line comment look like in Python

A

””” This is a Comment

print “This is also” “””

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

What are boolean operators, and how do they look like

A

and, or, not

Exaclty: and, or, not

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

How boolean constants should be properly written in Python

A

True, False

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

Can you double negation?

A

not not Ture - yes, you can

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

What is an order of evaluation of boolean operators.

A

not, and, or or (to separate)

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

Can you mix boolean expresions?

A
# Make me false
bool_one = (2
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How if statement is construct in Python. Explicitly, say what comes after single character

A
# if, condition without () and semicolon
if some condition:
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Do Python need ->;

A

No, too cool for that :)

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

How else if is written in python

A

elif expression:

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

How Python separates blocks.

How it is called

A

INDENTIONS

Thats how

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

How input function looks like! What does it return.

A

raw_input(“Message to display”)

17
Q

How is called function that checks if string contains only letter characters. How it is called with variable? What does it return - what is the return type

A

string.isalpha()

18
Q

Does lower() function modifies the string?

A

No, it only returns the string with all lower case letters. “Maciej”.lower() == “maciej”

19
Q

How can you take the letter from a string: maciej = “Maciej”.
Take the second letter.

A

second = maciej[1]

20
Q

How to slice strings. How to write that. slice name=”Maciej” to display “aciej”

A

name[1:len(name)]