Counting number of vowels in a string in Python -


ठीक है, तो मैंने जो किया था

  def countvowels (st): result = st गिनती ( "एक") + st.count ( 'ए') + st.count ( "e") + st.count ( 'ई') + st.count ( "मैं") + st.count ( "मैं" ) + St.count ("o") + st.count ("ओ") + st.count ("u") + st.count ("यू") रिटर्न परिणाम  

यह काम करता है (मुझे पता है कि इस पोस्ट में गलत संकेत हो सकता है, लेकिन जिस तरह से मैंने इसे अजगर में दबाया है, यह काम करता है)।

क्या ऐसा करने का एक बेहतर तरीका है? Loops के लिए प्रयोग?

मैं कुछ ऐसा करूँगा

  def countvowels (एसटी): रिटर्न लेन ((सी के लिए सी में सी 'एलईईओ' में) सी) कम   

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

c++ - Qt-how to convert a QByteArray to struct -

c# - How to know the number of Threads created and limit the Tasks accordingly -