Login using Social Account
     Continue with GoogleLogin using your credentials
Here, we will create a sample Python script with dead code. We will use vi
to write the script.
vi
is used to:
vi
has multiple modes: command mode, insert, append mode. In the beginning, it is in command mode. you can type a
to change the mode to append mode. Once in append mode, you can type text content.
We pass the commands such as quit file, delete line, search etc in command mode. If you want to change the mode to command mode, press ESC
key.
To exit from the file, we press ESC
key to go to command mode and type :wq
and hit the Enter
key. In vi
, :wq
, w
means save, and q
means quit.
Create a file named dead_code.py
using vi
with the following command:
vi dead_code.py
Now enter the following content in the dead_code.py
script:
import os
class Greeter:
def greet(self):
print("Hi")
def hello_world():
message = "Hello, world!"
greeter = Greeter()
greet_func = getattr(greeter, "greet")
greet_func()
if __name__ == "__main__":
hello_world()
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
No hints are availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...