Post

Khalid | Python Tasks Adventurer ๐Ÿ
โœ… Answer The correct answer is: 2. x = ("A", "B", "C") (Tuple) ๐ŸŽ‰ Why? โœ”๏ธ Tuples are immutable, so theyโ€™re safer for fixed choices. โšก More memory-efficient than lists. ๐Ÿงญ They're ordered and indexable, so random.choice() works perfectly
English
1
0
0
33
Khalid | Python Tasks Adventurer ๐Ÿ
โŒ Letโ€™s look at the other options: 1. List โ€“ โœ… Valid, but it's mutable, not ideal for constants. 3. Set โ€“ โŒ Not allowed with random.choice() โ€“ sets are unordered. 4. String โ€“ Technically works, but it's not clear you're choosing from multiple items.
English
0
0
0
26
Bagikan