6.3 Inline IF Flashcards

1
Q

What is an inline F statement?

A

It is a simpler form of an IF statement and is more convenient if you need to perform a very simple task.

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

What’s the syntax for inline F statement?

A

do Task A if condition is True else do Task B.

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

Write the script for inline F function.

A

userInput = input (“Enter 1 or 2:”)

print(“This is task A” if userInput == “1” else “This is task B”)

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