162k views
3 votes
Given two variables hasToner and hasPaper of type bool, that have been declared and given values, write a code block that will output "Need supplies" if either is not true, otherwise output "Printing...". In either case, end with a newline.

1 Answer

4 votes

Answer:

# hasToner variable of type bool

hasToner = True

# hasPaper variable of type bool

hasPaper = False

# The if statement check if hasPaper and

# hasToner is true. If True, it display

# "Printing" and end with new line

if(hasPaper and hasToner):

print("Printing", end="\\")

# If either of the variable is false

# It display "Need supplies" and end with new line

else:

print("Need supplies", end="\\")

Step-by-step explanation:

The value of hasToner and hasPaper can be changed to any boolean type and the required output will be gotten

User Iyke
by
5.2k points