While coding tasks for this topic you are expected:
1) Manipulate only integers (not strings)
2) Only use sequence construct (not to use selection or loops)
3) Use no built-in functions (the only allowed function is "int")
1.1 Hours to Minutes
1.2 Days to hours, minutes, seconds
Coding Exercise: Days to hours, minutes, seconds
Given the number of days (1 day has 24 hours). Write a program to calculate the number of hours, the number of minutes and the number of seconds in the given number of days.
You need to create an account and log in to ask a question.
1.3 Removing middle digit
Coding Exercise: Removing middle digit
Given a 3 digit number. Write a program to remove the middle digit, i.e. to output 2 digit number. For example, if the given number is 368, the output should be 38.
You need to create an account and log in to ask a question.
1.4 Product of middle digits
Coding Exercise: Product of middle digits
Given two three digit integer numbers. Write a program to calculate the product of the middle digits of both numbers. For example, if the given integers are 128 and 845, the output should be equal to 8, because 2*4 = 8.
You need to create an account and log in to ask a question.
1.5 Challenge with 5 digit number
Coding Exercise: Challenge with 5 digit number
Given an integer number consisting of 5 digits. Write a program, that calculates 3 following numbers:
a. Swaps the second and the last digits
b. Removes three middle digits
c. Calculates the sum of squares of all the digits
For example, if the given number is equal to 54208, then your program should output:
58204
58
109
You need to create an account and log in to ask a question.
1.6 Rock, Scissors, Paper
Coding Exercise: Rock, Scissors, Paper
Two players - Adam and Bob - play "Rock, Scissors, Paper" game multiple times. Both start with 0 points. If a player wins the game, then his score is increased by 1, and the other player's score is decreased by 1.
At the end of the day they know how many times each of them chose rock, paper and scissors. Find out the smallest and the largest amount of points that Adam could have scored at the end of the day.
Input consist of two rows. The first row contains the number of times Adam chose rock, paper and scissors. The second row contains the same numbers for Bob.
Output two numbers in two rows: the largest and the smallest score for the Adam.
For example, if the input is
1 2 3
3 2 1
The output should be:
4
-5
4 is achieved by playing: RPPSSS and RRRPPS
-5 is achieved by playing: RPPSSS and PPSRRR.
For solving this problem you can use built-in functions (e.g. map(int, input().split())) for data input and "min" function for finding the smallest value. Neither use of loops, nor use of conditionals (if) is required to solve this task.
You need to create an account and log in to ask a question.