WGU Python D522 – Questions With Definite
Solutions
Save
Practice questions for this set
Learn 1 /7 Study using Learn
1.6666
Choose an answer
print(10 > 9)
if x = 5
1 2 print(10 == 9)
what is x /= 3
print (10 < 9)
3 print( ) 4 int( )
Don't know?
Terms in this set (162)
print(10 > 9) Boolean
print(10 == 9)
print (10 < 9)
,print(bool("Hello")) Boolean examples of True
print(bool("15"))
print(bool(x))
print(bool(False)) Boolean examples of False
print( )
print(0)
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=" ") will end with a space and continue on the same line
print("more text") ("text more text")
print("Wage", wage) comma will print both items with a space between
them
print(variable) prints the value of the variable
print("1\n2\n3") print using newline characters
print( ) print a blank line
python file.py run a script file
, random function there is no random function, but there is a random
module
(import random)
for x in "bananas": strings are arrays, so this will loop through the
print(x) characters in "bananas"
variable=input( ) assign text entered by the user to a variable; input is
always a string
variable = int(input) convert user input into an integer
hourly_wage = int(input("Enter hourly display text prompt (Enter hourly wage) to request
wage: ")) input from user and convert to integer
print(a.upper( )) display a in console in upper case
print(a.lower( )) display a in console as lower case
print(a.strip( )) remove whitespace at beginning and end
print(a.replace("H", "J")) replace a string with another string
print(a.split("b")) split string at specified character
c=a+b concatenate (combine) two strings
print(c)
a=(f"My name is John, I am {age}") f-string; { } is the placeholder/modifier
print(a)
a = 85.8756 modifier to format the value to 2 decimal places
b = format(a, ".2f") (85.88)
print(b)
Solutions
Save
Practice questions for this set
Learn 1 /7 Study using Learn
1.6666
Choose an answer
print(10 > 9)
if x = 5
1 2 print(10 == 9)
what is x /= 3
print (10 < 9)
3 print( ) 4 int( )
Don't know?
Terms in this set (162)
print(10 > 9) Boolean
print(10 == 9)
print (10 < 9)
,print(bool("Hello")) Boolean examples of True
print(bool("15"))
print(bool(x))
print(bool(False)) Boolean examples of False
print( )
print(0)
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=" ") will end with a space and continue on the same line
print("more text") ("text more text")
print("Wage", wage) comma will print both items with a space between
them
print(variable) prints the value of the variable
print("1\n2\n3") print using newline characters
print( ) print a blank line
python file.py run a script file
, random function there is no random function, but there is a random
module
(import random)
for x in "bananas": strings are arrays, so this will loop through the
print(x) characters in "bananas"
variable=input( ) assign text entered by the user to a variable; input is
always a string
variable = int(input) convert user input into an integer
hourly_wage = int(input("Enter hourly display text prompt (Enter hourly wage) to request
wage: ")) input from user and convert to integer
print(a.upper( )) display a in console in upper case
print(a.lower( )) display a in console as lower case
print(a.strip( )) remove whitespace at beginning and end
print(a.replace("H", "J")) replace a string with another string
print(a.split("b")) split string at specified character
c=a+b concatenate (combine) two strings
print(c)
a=(f"My name is John, I am {age}") f-string; { } is the placeholder/modifier
print(a)
a = 85.8756 modifier to format the value to 2 decimal places
b = format(a, ".2f") (85.88)
print(b)