Syntax, Strings and Console Output Flashcards

1
Q

variable assigning

A

variableName = ‘string or anything’

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

Accesing the letter from a string, first for example.

A

“Maciej”[0] == ‘M’

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

Function return length of an object, string for example.

A

len(“string”)

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

Function creating string from object, number for example.

A

str(1)

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

Function returning string in lower cases.

A

string.lower()

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

Function returning all letters in upper case.

A

string.upper()

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

Does Python do string concatenation with + ? Does Python do it auctomatically.

A

Yes, it uses + for concatenation, but Python is strongly typed.

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

Simple function for printing text

A

print “Hello world”

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

Formated printing.

A

print “The string is %s” % (varableString)

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

Multiple variables formated print

A

print “%s, %s, %s” % (name, last, age)

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

Reading from input

A

raw_input(“Messege for input”)

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