Checking for a folder's existence

Similar to os.path.isfile(), there is another function called os.path.isdir(). It returns True if a folder exists at a specific location. We have been reviewing all code samples from a folder called code_samples located on the Raspberry Pi's desktop. It's existence could be confirmed as follows:

# Confirm code_samples' existence 
if os.path.isdir('/home/pi/Desktop/code_samples'):
print('The directory exists!')
else:
print('The directory does not exist!')