Page 1 of 51
1
WGU D522 PYTHON EXAM ACTUAL EXAM LATEST UPDATE
THIS YEAR COMPLETE 300 QUESTIONS AND CORRECT
ANSWERS ALREADY GRADED A+
WGU D522
What built-in data type is used when you assign text to your variable?str x = "Hello, World!" x = str("Hello, World!") What built-in data type is used when you assign a numeric value to your variable?int x = 20 x = int(20)
float x = 20.5 x = float(20.5)
complex x = 1j x = complex(1j) What built-in data type is used when you assign a sequence to your variable?list x = ["apple", "banana", "cherry"] 1 / 4
Page 2 of 51
2 x = list(("apple", "banana", "cherry"))
tuple x = ("apple", "banana", "cherry") x = tuple(("apple", "banana", "cherry"))
range x = range(6) What is the difference between a list and a tuple?list = collection of values tuple = ordered and unchangeable What built-in data type is used when you assign a mapping to your variable?dict x = {"name" : "John", "age" : 36} x = dict(name="John", age=36) What built-in data type is used when you assign a set to your variable?set x = {"apple", "banana", "cherry"} x = set(("apple", "banana", "cherry"))
frozenset x = frozenset({"apple", "banana", "cherry"}) x = frozenset(("apple", "banana", "cherry")) What built-in data type is used when you assign a boolean to your variable? 2 / 4
Page 3 of 51
3 bool x = True x = bool(5) What built-in data type is used when you assign binary to your variable?bytes x = b"Hello" x = bytes(5)
bytearray x = bytearray(5)
memoryview x = memoryview(bytes(5)) What built-in data type is used when you assign the value none to your variable?nonetype x = none print(10 > 9) print(10 == 9) print (10 < 9) Boolean print(bool("Hello")) print(bool("15")) print(bool(x)) 3 / 4
Page 4 of 51
4 Boolean examples of True print(bool(False)) print( ) print(0) Boolean examples of False print(isinstance(x, int)) determine if an object is of a certain data type int( ) casts an integer from an integer literal, float literal, or string literal float( ) casts a float from an integer literal, a float literal, or a string literal str( ) casts a string from strings, integer literals, or a float literals print("text") outputs text to the console print("text", end=" ") print("more text") will end with a space and continue on the same line ("text more text") print("Wage", wage)
- / 4