Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is Python Interactive Mode?
Python Interactive Mode is a way to run Python commands one at a time and see the result immediately. It is like talking to Python directly, typing commands and getting answers right away.
Click to reveal answer
beginner
What is Python Script Mode?
Python Script Mode means writing many Python commands in a file and then running the whole file at once. It is like writing a recipe and then cooking it all together.
Click to reveal answer
beginner
How do you start Python Interactive Mode?
You start Python Interactive Mode by opening a terminal or command prompt and typing 'python' or 'python3'. Then you can type commands and see results immediately.
Click to reveal answer
beginner
How do you run a Python script file?
You run a Python script by saving your code in a file with '.py' extension and then running 'python filename.py' in the terminal or command prompt.
Click to reveal answer
beginner
What is a key difference between Interactive Mode and Script Mode?
Interactive Mode runs one command at a time and shows results immediately, good for testing and learning. Script Mode runs all commands in a file at once, good for bigger programs.
Click to reveal answer
How do you start Python Interactive Mode?
AType 'python' in the terminal
BSave code in a .py file
CRun 'python filename.py'
DOpen a text editor
✗ Incorrect
Typing 'python' in the terminal starts the interactive mode where you can type commands one by one.
What file extension do Python scripts usually have?
A.doc
B.txt
C.exe
D.py
✗ Incorrect
Python scripts are saved with the '.py' extension.
Which mode is better for testing small pieces of code quickly?
AScript Mode
BInteractive Mode
CBoth are the same
DNone of the above
✗ Incorrect
Interactive Mode lets you run commands one at a time and see results immediately, making it great for quick tests.
How do you run a Python script file?
AType 'python' and press enter
BDouble click the .txt file
CType 'python filename.py' in terminal
DOpen Python Interactive Mode
✗ Incorrect
Running 'python filename.py' in the terminal executes the whole script file.
What happens in Script Mode?
AAll commands in the file run together
BCommands run one by one with immediate output
COnly syntax errors are shown
DPython shuts down automatically
✗ Incorrect
In Script Mode, the entire script file runs from top to bottom at once.
Explain the difference between Python Interactive Mode and Script Mode.
Think about how you talk to Python in each mode.
You got /4 concepts.
How do you start Python Interactive Mode and how do you run a script file?
One is typing just 'python', the other includes the file name.
You got /2 concepts.
Practice
(1/5)
1. What is the main difference between Python interactive mode and script mode?
easy
A. Interactive mode is slower than script mode.
B. Interactive mode runs files; script mode runs commands one by one.
C. Interactive mode runs commands one by one; script mode runs a whole file at once.
D. Script mode shows results immediately after each command.
Solution
Step 1: Understand interactive mode behavior
Interactive mode lets you type and run one command at a time and see the result immediately.
Step 2: Understand script mode behavior
Script mode runs a saved file with many lines of code all at once, not line-by-line interactively.
Final Answer:
Interactive mode runs commands one by one; script mode runs a whole file at once. -> Option C
Quick Check:
Interactive = one command, Script = whole file [OK]
Hint: Interactive = one command; script = whole file run [OK]
Common Mistakes:
Confusing which mode runs commands one by one
Thinking script mode shows immediate results after each line
Believing interactive mode runs whole files
2. Which of the following is the correct way to start Python in interactive mode from a terminal?
easy
A. python script.py
B. python
C. python -i script.py
D. python run script.py
Solution
Step 1: Identify command to start interactive mode
Typing python alone in the terminal starts Python in interactive mode.
Step 2: Understand other options
python script.py runs a script, python -i script.py runs script then interactive, and python run script.py is invalid syntax.
Final Answer:
python -> Option B
Quick Check:
Just type python to start interactive mode [OK]
Hint: Type 'python' alone to start interactive mode [OK]
Common Mistakes:
Using 'python script.py' to start interactive mode
Confusing flags like -i without understanding
Typing invalid commands like 'python run script.py'
3. What will be the output if you run this code in interactive mode line by line?
print('Hello')
2 + 3
print('Done')
medium
A. Hello\nDone
B. Hello\n3\nDone
C. Hello\nNone\nDone
D. Hello\n5\nDone
Solution
Step 1: Analyze print statements in interactive mode