Answer:
In Python:
def is_power(n):
if n > 2:
n = n/2
return is_power(n)
elif n == 2:
return True
else:
return False
Explanation:
This defines the function
def is_power(n):
If n is greater than 0
if n > 2:
Divide n by 2
n = n/2
Call the function
return is_power(n)
If n equals 2
elif n == 2:
Return True
return True
If n is less than 2
else:
Then, return false
return False
Answer:
True
Explanation:
Some collection of classes or library functions grouped as one name space. A class which belongs to one namespace is different from the class which belongs to another namespace. we can identify a class uniquely with it's namespace .
for ex:
in c#.net
using system;
System.IO;
here System is the namespace which contains class IO
namespace contains any number of classes . In one namespace we can't define two classes with same Name. We can define two classes with same name in different namespaces
Answer:
# import the turtle library
from turtle import *
# create a turtle space
space = Screen()
# create a turtle object
z = Turtle()
# create a single Z
z.forward(50)
z.right(120)
z.forward(100)
z.left(120)
z.forward(50)
# adjust the turtle position
z.up()
z.left...
Explanation: