3. The Last 'Zeroes'
How many zeroes are there after the last non-zero digit of a million? A trillion? To easily identify that, let us make a program to count and print the number of zeroes after the last non-zero digit on a number. For example, in 20400, there are 2 zeroes after the last non-zero digit of the number, 4.
Are you up for this challenge?
Input
A line containing an integer.
20400
Output
A line containing an integer.
2
2. Phonics
Did you know that the first letters in the alphabet that a child learns are the vowels? Well, since they're the first letters that we learned as babies, then they must be easy to identify, right? So, let's make a code that will identify all vowels in a string and print out how many they are!
Let's go!
Input
A line containing a string.
CodeChum
Output
A line containing an integer.
3
1. FizzBuzz 2.0
Remember the game of FizzBuzz from the last time? Well, I thought of some changes in the game, and also with the help of loops as well. Firstly, you'll be asking for a random integer and then loop from 1 until that integer. Then, implement these conditions in the game:
• print "Fizz" if the number is divisible by 3.
• print "Buzz" if the number is divisible by 5.
• print "FizzBuzz" if the number is divisible by both 3 and 5.
• print the number itself if none of the above conditions are met.
Input
A line containing an integer.
15
Output
Multiple lines containing a string or an integer.
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
Given X="ABCDEFGHIJKLMNOPQRSTUVWXYZ", X[8:16:2] is?
a) IKMO
b) IKMOQ
c) HJLNP
d) Error
This problem is related to the virtual learning environment application discussed in one theory session and a few practicals. In this problem, you are tasked with creating and updating learner profiles, a particular type of user. As well, given a learner profile, we would like to retrieve the learning materials in the form of topics. Note that the learning materials for a given course will differ from one learner profile to another. For example, for a course "Distributed Systems and Applications", the learning materials for a learner with a weak background in "Programming" compared o another learner profile with a stronger background in programming.
Your task is to:
1. Provide a description in OpenAPI of the API that allows for communication between a client and a service for the functionalities discussed above;
2. Implement a corresponding client and a service.
Word Count
Given a sentence S, write a program to print the frequency of each word in S. The output order should correspond with the word's input order of appearance.
Numbers in String - 2
Given a string, write a program to return the sum and average of the numbers that appear in the string, ignoring all other characters.
Secret Message - 2
Given a string, write a program to print a secret message that replaces characters with numbers 'a' with 1, 'b' with 2, ..., 'z' with 26 where characters are separated by '-'.
Note: You need to replace both uppercase and lowercase characters. You can ignore replacing all characters that are not letters.
a b c d e f g h i j
1 2 3 4 5 6 7 8 9 10
k l m n o p q r
11 12 13 14 15 16 17 18
s t u v w x y z
19 20 21 22 23 24 25 26
In this exercise, use the following <span style="text-decoration-line: none;">variables</span>: i,lo, hi, and result. Assume that lo and hi each are associated with an int and that result refers to 0.
Write a while loop that adds the integers from lo up through hi (inclusive), and associates the sum with result.
Your code should not change the values associated with lo and hi. Also, just use these <span style="text-decoration-line: none;">variables</span>: i,lo, hi, and result.