quiz حل الأسئلة الجامعية manage_search الأرشيف

تم الحل ✓
categoryبرمجة وتطوير البرمجيات schoolبكالوريوس event_available2026-07-14

السؤال

Transcribed Image Text:

1. 30 Points: Write a class named WeirdString that inherits from str and provides a custom iterator. You must write the entire class yourself, I just put the class names in the .py file to make sure you understand two classes are needed. The iterator skips any character that is not a vowel. It is important to understand that the iterator doesn't return None when it encounters a vowel, it finds the next valid character in the sequence and returns it. Here are some examples of its usage. >>> s=WeirdString("abcdefghijklmnopqrstuvwxyx") >>> for 1 in s: print ("Non Vowel character found: " , 1) Non Vowel character found: b j k Non Vowel character found: C Non Vowel character found: d Non Vowel character found: f Non Vowel character found: g Non Vowel character found: h Non Vowel character found: Non Vowel character found: Non Vowel character found: 1 Non Vowel character found: m Non Vowel character found: n Non Vowel character found: P Non Vowel character found: q Non Vowel character found: I Non Vowel character found: S Non Vowel character found: t Non Vowel character found: V Non Vowel character found: W Non Vowel character found: x Non Vowel character found: Y Non Vowel character found: x >>> s=WeirdString("aeiou") >>> for 1 in s: print ("Non Vowel character found: ", 1) >>> s=WeirdString("The Cat in the Hat") >>> for i in s: print (i) T h EF t 42 L n¸ th H t

check_circle الجواب — حل مفصل خطوة بخطوة

hourglass_top