Right Answer:
Yes, Python 3 is considered a general-purpose language because it can be used for a wide variety of applications, from web development to scientific computing, making it versatile and adaptable to different tasks.
Right Answer:
Yes, Python 3 is considered a general-purpose language because it can be used for a wide variety of applications, from web development to scientific computing, making it versatile and adaptable to different tasks.
Right Answer:
In Python, to define a block of code we use indentation. Indentation refers to whitespaces at the beginning of the line.
Right Answer:
Many languages have been implemented using both compilers and interpreters, including C, Pascal, and Python.
Right Answer:
The def keyword is used to create, (or define) a function in python.
Right Answer:
Standard libraries in Python provide a rich set of modules and functions that allow developers to perform common tasks without needing to write code from scratch. This enhances productivity and makes Python suitable for a broad range of applications.
Right Answer:
Python supports the creation of anonymous functions (i.e. functions that are not bound to a name) at runtime, using a construct called lambda. Lambda functions are restricted to a single expression. They can be used wherever normal functions can be used.
x<<2
Right Answer:
The binary form of 1 is 0001. The expression x<<2 implies we are performing bitwise left shift on x. This shift yields the value: 0100, which is the binary form of the number 4.
Right Answer:
‘.py’ is the correct extension of the Python file. Python programs can be written in any text editor. To save these programs we need to save in files with file extension ‘.py’.
Right Answer:
Python's interpreted nature allows for quick iteration and prototyping, which is invaluable in research and development phases. Developers can test and modify their code on the fly without the need for a separate compilation step.
i = 1
while True:
if i % 3 == 0:
break
print(i)
i += 1
Right Answer:
SyntaxError, there shouldn’t be a space between + and = in +=.