1/7
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
a. Interpreter
An interpreter is a program that directly executes instructions written in a programming language without requiring them to be compiled into machine code first.
b. Runtime Error
A runtime error occurs during the execution of a program and usually causes the program to crash or behave unexpectedly.
c. Function
A function is a reusable block of code designed to perform a specific task when called.
Write a function which returns the reverse complement of a DNA sequence
def reverse_complement(seq):
complement = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
return ''.join(complement[base] for base in reversed(seq))
;What is the output of type(x) after: x = 10.0; x = True; x = None?
<class 'NoneType'>
;What is the value stored in x after: x = y[1:3]; x = y[::2]; x = y[-1]?
400
5. The following code contains syntax and logic errors. Correct them and underline your changes.
python
CopyEdit
#!/usr/bin/env python3
def greet(name)
print("Hello, " + name)
greet('World'
#!/usr/bin/env python3
def greet(name): # <- added colon
print("Hello, " + name) # <- indented properly
greet('World') # <- closed parenthesis