



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




What type of programming language is Python? An interpreted, high-level, general-purpose programming language.
What is the main advantage of Python's syntax? It emphasizes readability and expressiveness.
How is a Python script executed? It is executed directly by an interpreter at runtime without pre-compilation.
What is a key feature of Python's standard library? It is vast and augmented by a large array of third- party libraries.
Which companies have adopted Python for their applications? Google, Uber, Facebook, and Mozilla.
What command is used to print a message in Python? The print() function.
How do you write a comment in Python? By using the hash symbol (#) before the comment text.
What is a documentation string in Python? A multiline comment written with three opening and closing double quotes.
How do you create a string that displays 'Hello' five times? Use the code: print('Hello ' * 5).
What is the purpose of the sys module in Python? To access command-line arguments passed to the script.
What are variables in Python? References to values in memory that do not require pre-declaration of data types.
How are strings represented in Python? As arrays of bytes representing unicode characters.
How do you access a substring in Python? By using slicing with the syntax string[start:end].
What are lists in Python? An aggregate data type composed of other data types.
What is the structure used to create a list in Python? A list is created with comma-separated elements enclosed in square brackets.
How do you access the first element of a list named 'fruits'? Use indexing: fruits[0].
What happens when you change a value in a list? Lists are mutable, meaning you can change their values.
What do comparison operators return? They return Boolean data types, which can be either True or False.
What does the 'in' operator do in Python? It tests for membership in a collection.
What is a control statement? A structure in code that conditionally changes the program flow.
What is the difference between a for loop and a while loop? A for loop runs a predetermined number of times, while a while loop runs as long as a condition is satisfied.
What does the range function do? It generates a list of numbers based on specified start, stop, and step parameters.
What is the purpose of the break statement? To exit a loop based on a condition external to the loop.
What is a user-defined function? A function defined by the user to organize code into logical fragments.
What is the difference between local and global variables? Local variables are defined inside a function and accessible only there; global variables are defined outside and accessible everywhere.
How do you create a dictionary in Python? Use curly braces with key-value pairs, e.g., {'key': 'value'}.