Verified Answers
Boolean - CORRECT ANSWER print(10 > 9)
print(10 == 9)
print (10 < 9)
Boolean examples of True - CORRECT ANSWER print(bool("Hello"))
print(bool("15"))
print(bool(x))
Boolean examples of False - CORRECT ANSWER print(bool(False))
print( )
print(0)
determine if an object is of a certain data type - CORRECT ANSWER
print(isinstance(x, int))
casts an integer from an integer literal, float literal, or string literal - CORRECT
ANSWER int( )
casts a float from an integer literal, a float literal, or a string literal - CORRECT
ANSWER float( )
,casts a string from strings, integer literals, or a float literals - CORRECT ANSWER
str( )
outputs text to the console - CORRECT ANSWER print("text")
will end with a space and continue on the same line ("text more text") - CORRECT
ANSWER print("text", end=" ")
print("more text")
comma will print both items with a space between them - CORRECT ANSWER
print("Wage", wage)
prints the value of the variable - CORRECT ANSWER print(variable)
print using newline characters - CORRECT ANSWER print("1\n2\n3")
print a blank line - CORRECT ANSWER print( )
run a script file - CORRECT ANSWER python file.py
there is no random function, but there is a random module
(import random) - CORRECT ANSWER random function
, strings are arrays, so this will loop through the characters in "bananas" - CORRECT
ANSWER for x in "bananas":
print(x)
assign text entered by the user to a variable; input is always a string - CORRECT
ANSWER variable=input( )
convert user input into an integer - CORRECT ANSWER variable = int(input)
display text prompt (Enter hourly wage) to request input from user and convert to
integer - CORRECT ANSWER hourly_wage = int(input("Enter hourly wage: "))
display a in console in upper case - CORRECT ANSWER print(a.upper( ))
display a in console as lower case - CORRECT ANSWER print(a.lower( ))
remove whitespace at beginning and end - CORRECT ANSWER print(a.strip( ))
replace a string with another string - CORRECT ANSWER print(a.replace("H", "J"))
split string at specified character - CORRECT ANSWER print(a.split("b"))
concatenate (combine) two strings - CORRECT ANSWER c=a+b
print(c)