-
Make variables called:
total_number_of_dots
and set its value to 0.number_of_dots
and set its value to 16.cards
and set its value to the string entered as the input. Check each letter of the input stringcards
(use a for loop to iterate 5 times) starting from the first letter. If it’s ‘W’ add the corresponding number of dots (16 for the first letter, 8 for the second letter and so on) to thetotal_number_of_dots
. Display thetotal_number_of_dots
as the output.
-
You can access a letter at the specified position in a string by using brackets. In your for loop, if you use the variable 'i' to iterate, cards[i] will get the value at index i in cards
-
In this challenge you need to access all the 5 letters in user’s input and check to see if each of them is equal to B (black) or W (white).