Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

qweqweq

// MODIFY THIS AREA
// [filename]: a1_q1.go
// [question]: [question number]
// [instagram username]: [username]
package main

import ("fmt"
  
)

func main() {
	vowels := []string{"a", "e", "u", "i", "o"}
	scores := []int{12, 8, 1, 4, 3}

	usernames := []string{"westdabestdb", "elonmusk", "vancityreynolds", "porkbundomains", "yourusernamehere"}
	for _, username := range usernames {
		score := scoreCalculator(vowels, scores, username)
		fmt.Printf("%v score: %v \n",username,score)
	}
    
    
}

func scoreCalculator(vowels []string, scores []int, usernames string) int {
    if len(vowels) != len(scores) {
        return 0
    }
    score := 0
    for _, v := range usernames {
        for i, j := range vowels {
            if string(v) == j {
                score += scores[i]
            }
        }
        
    }
    return score
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.