Day one - Variables Flashcards

1
Q

How to print several things line below line using the same ‘print’?

A
Using \n after the end of the message and beginning of where you want to separate.
print('Hello\nHello\nHello')
Hello
Hello
Hello
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to write comments?

A

Use # before the text.

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

Can you add many commands on the same line?

A

Yes.

print(‘Hello’ + input(‘Write your name: ‘)

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

What can you do if you desire to write a code inside of a print function?

A

You have to use single and double comas.

print(“print(‘Data’)’)

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

What to do if you want the answer of an input to be answered on the next line?

A

Use a \n at the end of it.

a = input(‘What is you name?\n’)

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