3. Variable, Expressions, Statements Flashcards

1
Q

i index is used when we want to make

A

a loop

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

without i, the loop will continue

A

infintely

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

elements needed in loop

A

Initialization Statement (i = x)

Loop Condition (if i == 10)

Update Statement (i = i+1)

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

Use of type()

A

to get the type a value/variable belongs

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

naming rules:

1st Character

A
  • Alphabets (lowercase or uppercase)

* Underscore ( _ )

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

naming rules:

2nd Character onwards

A
  • Alphabets (lowercase or uppercase)
  • Underscore ( _ )
  • Digits
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

naming rules:

CANNOT be

A

Python’s keywords,

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

/

A

(floating-point division)

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

//

A

(integer division)

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

**

A

Exponentiation

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

mod is the

A

remainder of a division

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

str +

A

Concatenation

“Tony” + “Stark” = “TonyStark”

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

str *

A

Repetition

“Tony” * 3 = “TonyTonyTony”

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

Rules of Precedence =

A

PEMDAS

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

Expressions

A

A combination of values, variables, and operators.

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

input:

name = input(“Enter your name”)

“Enter your name” is the

A

prompt

17
Q

input:

name = input(“Enter your name”)

Output?

A

Enter your name

18
Q

print(‘python’,’is’,’easy’)

By default,

A

the data will be separated by space when shown.

19
Q

Use the sep argument to

A

change the separator to any string.

20
Q

Use the end argument

A

to change the end character for the

print statement.

21
Q

mod can be use to

A

check whether one number is divisible by another

extract the right-most digit or digits from a number