Complete the code to check if a number is positive and less than 10.
if num > 0 [1] num < 10: print("Number is between 1 and 9")
The and operator checks if both conditions are true.
Complete the code to check if a character is a vowel or a digit.
if char in 'aeiou' [1] char.isdigit(): print("It's a vowel or a digit")
The or operator checks if either condition is true.
Fix the error in the condition to check if a number is not between 5 and 15.
if num < 5 [1] num > 15: print("Number is outside 5 to 15")
To check if a number is outside the range, use or between the two conditions.
Fill both blanks to create a dictionary of words with length greater than 3 and containing letter 'a'.
result = {word: len(word) for word in words if len(word) [1] 3 [2] 'a' in word}We want words longer than 3 and containing 'a'.
Fill all three blanks to create a dictionary of uppercase keys and values for words longer than 4 or containing 'e'.
result = [1]: [2] for word in words if len(word) [3] 4 or 'e' in word
Keys are uppercase words, values are original words, and condition checks length > 4 or contains 'e'.