Check Anagrams in Python
Check Anagrams in Python को संपादित और ऑनलाइन चलाए जा सकने वाले व्यावहारिक उदाहरण से सीखें।
Check Anagrams क्या है?
Check Anagrams in Python को संपादित और ऑनलाइन चलाए जा सकने वाले व्यावहारिक उदाहरण से सीखें।
इसका उपयोग कब करें?
- चलने योग्य code से Python syntax सीखें।
- बड़ी programming समस्याओं से पहले मजबूत आधार बनाएँ।
- स्थानीय setup के बिना किसी विचार को तुरंत जाँचें।
उदाहरण कोड
main.py
def normalize(text):
# Ignore spaces, punctuation, and letter case.
return sorted(character.lower() for character in text if character.isalpha())
first, second = "listen", "silent"
result = "are" if normalize(first) == normalize(second) else "are not"
print(f"{first} and {second} {result} anagrams")
अपेक्षित आउटपुट
listen and silent are anagrams
यह कैसे काम करता है
यह उदाहरण Check Anagrams in Python दिखाता है। कोड समझने के लिए इनपुट मान बदलें।
मान बदलें और Python इंस्टॉल किए बिना CodeUtility ऑनलाइन Python कंपाइलर में प्रोग्राम चलाएँ।
अभ्यास के कार्य
बड़े dataset पर जाने से पहले input बदलें और edge cases की जाँच करें।
- Code चलाने से पहले output का अनुमान लगाएँ।
- खाली और गलत input संभालें।
- Logic को function में रखें और tests जोड़ें।