Complete the code to check if a is less than b.
let a = 5; let b = 10; let result = a [1] b; println!("{}", result);
The operator < checks if the left value is less than the right value.
Complete the code to check if x is equal to y.
let x = 7; let y = 7; let is_equal = x [1] y; println!("{}", is_equal);
The operator == checks if two values are equal.
Fix the error in the code to check if num is not equal to 0.
let num = 3; let check = num [1] 0; println!("{}", check);
The operator != checks if two values are not equal.
Fill the blank to create a dictionary with words as keys and their lengths as values, only for words longer than 3 letters.
let words = ["apple", "cat", "banana", "dog"]; let lengths = words.iter().filter(|&&word| word.len() [1] 3).map(|&word| (word, word.len())).collect::<std::collections::HashMap<_, _>>();
The operator > filters words with length greater than 3.
Fill the blanks to create a HashMap with uppercase keys and values greater than 2.
let data = vec![("one", 1), ("two", 2), ("three", 3)]; let filtered: std::collections::HashMap<_, _> = data.into_iter() .filter(|&(_, v)| v [1] 2) .map(|(k, v)| (k.[2](), v)) .collect();
The operator > filters values greater than 2, and to_uppercase converts keys to uppercase.
