Lockdown Offer: FLAT 75% + Addl. 25% Off + 30-days Extra Lab on ALL Courses | Use Coupon Code LD25 during Checkout | Offer Expires In

  Enroll Now

Scala

20 / 52
   

Scala - Assessment - Write function to remove vowels

Let's now write a program which will remove all vowels from a given string.

Here, we will write a scala program whose main class name is Purge having a function named purgeVowels which would take a string as input and return another string with all vowels removed from the input string.

Usage Example:

Purge.purgeVowels("New York") should return "Nw Yrk".

INSTRUCTIONS
  • Switch to Jupyter tab.

  • Write the code in Jupyter.

The program skeleton will look like this. Complete the code of the function in this to remove the vowels from the input string.

object Purge {
   def purgeVowels( str:String ) : String = {
      return .....
   }
}

  • Press Shift+Enter.

  • Test the function with various inputs to make sure that it is returning the outputs as per requirements.

  • Click on "Submit Answer".


Note - Having trouble with the assessment engine? Follow the steps listed here