WGU D522 PYTHON FOR IT AUTOMATION
COMPLETE QUESTION SET WITH VERIFIED
SOLUTIONS GRADED A+
Question 1.
What are the two main escape characters?
ANSWER
\n : new line
\t : for a tab
Question 2.
How can a global variable be created inside a function in Python?
ANSWER
By declaring the variable with the 'global' keyword
Question 3.
What are the traits of Declarative Programming?
ANSWER
describes what the program should accomplish without specifying how to achieve it.
Question 4.
What is the purpose of the input() function in Python?
ANSWER
To capture user input and store it as a string
, Question 5.
What are the 5 Variable name rules in Python?
ANSWER
1. can only contain letters, numbers, or an underscore.
2. MUST start with either a letter or underscore
3. Cannot start with a number
4. Cannot contain special characters.
5. Cannot be a Python keyword (such as: and, as, def, else, etc)
Question 6.
How can multiple Python variables of different types be output using the print() function?
ANSWER
By separating each variable with a comma
Question 7.
What does the format() method do in Python?
ANSWER
It enhances output formatting by embedding variables in strings. (although 'f' strings are
easier to read)
Question 8.
What does this built in Python function do?: sum()
ANSWER
calculates the sum of elements in a sequence
Question 9.
What are the 3 sequence types in Python? what do they represent/look like?
ANSWER
list: Ordered, mutable sequence; [1,23]
tuple: Ordered, immutable sequence; (1,2,3)
range: represents a range of values; e.g. range(5)
COMPLETE QUESTION SET WITH VERIFIED
SOLUTIONS GRADED A+
Question 1.
What are the two main escape characters?
ANSWER
\n : new line
\t : for a tab
Question 2.
How can a global variable be created inside a function in Python?
ANSWER
By declaring the variable with the 'global' keyword
Question 3.
What are the traits of Declarative Programming?
ANSWER
describes what the program should accomplish without specifying how to achieve it.
Question 4.
What is the purpose of the input() function in Python?
ANSWER
To capture user input and store it as a string
, Question 5.
What are the 5 Variable name rules in Python?
ANSWER
1. can only contain letters, numbers, or an underscore.
2. MUST start with either a letter or underscore
3. Cannot start with a number
4. Cannot contain special characters.
5. Cannot be a Python keyword (such as: and, as, def, else, etc)
Question 6.
How can multiple Python variables of different types be output using the print() function?
ANSWER
By separating each variable with a comma
Question 7.
What does the format() method do in Python?
ANSWER
It enhances output formatting by embedding variables in strings. (although 'f' strings are
easier to read)
Question 8.
What does this built in Python function do?: sum()
ANSWER
calculates the sum of elements in a sequence
Question 9.
What are the 3 sequence types in Python? what do they represent/look like?
ANSWER
list: Ordered, mutable sequence; [1,23]
tuple: Ordered, immutable sequence; (1,2,3)
range: represents a range of values; e.g. range(5)