Multiple Assignment Flashcards

(3 cards)

1
Q

What is multiple assignments?

A

Multiple assignments allows us to assign multiple variables at the same time in one line of code.

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

How do you separate the variables in multiple assignments?

A

You must use a comma and it needs to follow the order you put it in.

To display in the Terminal Window, you would have to print the multiple variables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
Spongebob= 30
Patrick= 30
Sandy= 30
Squidward= 30

How would you use multiple assignments to display all of these in one line of code?

A

Spongebob=Patrick=Sandy=Squidward=30

print( Spongebob)
print( Patrick)
print (Sandy)
print (Squidward)

TWD:
30
30
30
30

OR

print(Spongebob,Patrick,Sandy,Squidward)

TWD: 30 30 30 30

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