Classes
Functions
Objects only
Namespaces
What does the following code do?
from datetime import datetime dt = datetime.strptime("2024-11-22", "%Y-%m-%d") print(dt)
Returns the current date
Converts the string "2024-11-22" to a datetime object
Returns the string "2024-11-22"
Raises a ValueError
import math
from math import pi
include math
using math
import math as m
from math import sqrt
load math
from math import * print(cos(0))
Prints 1.0
Raises a NameError
Prints cos(0)
Error
Global
Enclosing
Built-in
Local
argv[]
sys.argv
input()
args[]
A function
A package
A class
A file containing Python code
fun
u
Either f, u, or n
What is the output of following?
print(round(4.567, 2))
4.56
4.57
4.5
5
.py
.mod
.exe
.txt
Ignored
Compiled only
Executed once
Executed every time
Lifetime of an object
Region of code where a name is accessible
Size of a variable
Memory address
What will be the output of the code given below?
import math as m print(m.pi)
3.141592654
math.pi
None
Enclosing function scope
Built-in scope
Global scope
Local scope