Input, print and numbers - Learn Python 3 - Snakify

Lesson 1.Input, print and numbers



Problem «Sum of three numbers» (Easy)


Statement

Write a program that takes three numbers and prints their sum. Every number is given on a separate line.



Problem «Area of right-angled triangle» (Easy)


Statement

Write a program that reads the length of the base and the height of a right-angled triangle and prints the area. Every number is given on a separate line.



Problem «Apple sharing» (Medium)


Statement

N students take K apples and distribute them among each other evenly. The remaining (the undivisible) part remains in the basket. How many apples will each single student get? How many apples will remain in the basket?

The program reads the numbers N and K. It should print the two answers for the questions above.



Problem «Digital clock» (Hard)


Statement

Given the integer N - the number of minutes that is passed since midnight - how many hours and minutes are displayed on the 24h digital clock?

The program should print two numbers: the number of hours (between 0 and 23) and the number of minutes (between 0 and 59).

For example, if N = 150, then 150 minutes have passed since midnight - i.e. now is 2:30 am. So the program should print 2 30.



Problem «Hello, Harry!» (Easy)


Statement

Write a program that greets the user by printing the word "Hello", a comma, the name of the user and an exclamation mark after it. See the examples below.

Warning. Your program's output should strictly match the desired one, character by character. There shouldn't be any space between the name and the exclamation mark. You can use + operator to concatenate two strings. See the lesson for details.



Problem «Previous and next» (Medium)


Statement

Write a program that reads an integer number and prints its previous and next numbers. See the examples below. Remember that you can convert the numbers to strings using the function str.



Problem «School desks» (Hard)


Statement

A school decided to replace the desks in three classrooms. Each desk sits two students. Given the number of students in each class, print the smallest possible number of desks that can be purchased.

The program should read three integers: the number of students in each of the three classes, a, b and c respectively.

In the first test there are three groups. The first group has 20 students and thus needs 10 desks. The second group has 21 students, so they can get by with no fewer than 11 desks. 11 desks is also enough for the third group of 22 students. So we need 32 desks in total.