1/14
Flashcards to help study the topics in the 'Introduction to Python' chapter.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is the command: pip install packagename used for?
To install Python modules from PyPI.
What is the standard for indention in Python?
Four spaces for each block of code.
How are comments in Python denoted?
Which of the following are mutable data types?
Lists and Dictionaries.
Which of the following would create a dictionary?
a= dict() and a= {" name":"chris", "age": 45}
What data type does the input() function create when assigned to a variable?
String
Which print statement is valid for Python 3?
print('hello world')
How do if statements operate?
All of the above are correct.
Which statements are true about the range() function?
The range() function iterates by one, starting at 0, up to but not including the number specified and A range() function can count up or down, based on a positive or negative step value.
What does a virtual environment allows you to do?
Lock in the components and modules you use for your app into a single “package,” which is a good practice for building Python apps.
Why has the Python language become the most popular language in infrastructure automation?
Python language has become the most popular language in infrastructure automation because it is super easy to pick up and doesn’t have all of the crazy syntax and structure that you see in languages like Java or C.
What is the string data type?
A sequence of characters and uses quotes to determine which characters are included.
What does the list.append(element) method do?
Adds an element to the end of the list.
What is the difference between tuples and lists?
The biggest difference between the two comes down to mutability. Lists are mutable, and tuples are immutable.
What is a while loop?
Awhile loop is a conditional loop, and the evaluation of the condition (as in if statements) being true is what determines how many times the loop executes.