You are on page 1of 9

25-02-2024 12:35 Snakify Answers

Snakify Answers
To find a desired problem, press control+F and type the problem
name.

Section 1
1.1 – Sum of three numbers

a = int(input())
b = int(input())
c = int(input())
print(a + b + c)

1.2 – Hi John

name = input()
print('Hi', name)

1.3 – Square

a = int(input())
print(a ** 2)

1.4 – Area of right-angled triangle

a = int(input())
b = int(input())
print(a * b / 2)

1.5 – Hello, Harry!

print('Hello, ' + input() + '!')

1.6 – Apple sharing

n = int(input())
k = int(input())

https://snakifyanswers.wordpress.com 1/9
25-02-2024 12:35 Snakify Answers

print(k // n)
print(k % n)

1.7 – Previous and next

n = int(input())
print(‘The next number for the number ‘ + str(n) + ‘ is ‘ + str(n + 1) + ‘.’)
print(‘The previous number for the number ‘ + str(n) + ‘ is ‘ + str(n – 1) + ‘.’)

1.8 – Two timestamps

hours_1 = int(input())
minutes_1 = int(input())
seconds_1 = int(input())
hours_2 = int(input())
minutes_2 = int(input())
seconds_2 = int(input())
print(hours_2 * 3600 + minutes_2 * 60 + seconds_2
- hours_1 * 3600 - minutes_1 * 60 - seconds_1

1.9 – School desks

a = int(input())
b = int(input())
c = int(input())
print(a // 2 + b // 2 + c // 2 + a % 2 + b % 2 + c % 2)

Section 2
2.1 – Last digit of integer

a = int(input())
print(a % 10)

https://snakifyanswers.wordpress.com 2/9
25-02-2024 12:35 Snakify Answers

Yaris Cross Hybride voor de prijs van een…


Meer weten
TOYOTA - Sponsored

2.2 – Two digits

a = int(input())
print(a // 10, a % 10)

2.3 – Swap digits

a = int(input())
tens = a // 10
units = a % 10
print(units * 10 + tens)

2.4 – Last two digits

print(int(input()) % 100)

2.5 – Tens digit

n = int(input())
print(n // 10 % 10)

2.6 – Sum of digits

https://snakifyanswers.wordpress.com 3/9
25-02-2024 12:35 Snakify Answers

n = int(input())
a = n // 100
b = n // 10 % 10
c = n % 10
print(a + b + c)

2.7 – Reverse three digits

my_number = int(input())
print(str(my_number)[::-1])

2.8 – Merge two numbers

num0 = int(input())
num1 = int(input())
print(str(num0)[0]+str(num1)[0]+str(num0)[1]+str(num1)[1])

2.9 – Cyclic rotation

a = int(input())
print(a % 100 * 100 + a // 100)

2.10 – Fractional part

x = float(input())
print(x - int(x))

2.11 – First digit after decimal point

x = float(input())
print(int(x * 10) % 10)

2.12 – Car route

from math import ceil

n = int(input())
m = int(input())
print(ceil(m / n))

2.13 – Day of the week

https://snakifyanswers.wordpress.com 4/9
25-02-2024 12:35 Snakify Answers

k = int(input())
print((k + 3) % 7)

2.14 – Digital clock

n = int(input())
hours = n // 60
minutes = n % 60
print(hours, minutes)

2.15 – Total cost

a = int(input())
b = int(input())
n = int(input())
cost = n * (100 * a + b)
print(cost // 100, cost % 100)

2.16 – Century

year = int(input())
print((year - 1) // 100 + 1)

2.17 – Snail

from math import ceil

h = int(input())
a = int(input())
b = int(input())
print(ceil((h - a) / (a - b)) + 1)

2.18 – Clock face -1

h = int(input())
m = int(input())
s = int(input())

print(h * 30 + m * 30 / 60 + s * 30 / 3600)

2.19 – Clock face – 2

https://snakifyanswers.wordpress.com 5/9
25-02-2024 12:35 Snakify Answers

alpha = float(input())
print(alpha % 30 * 12)

Section 3
3.1 – Is positive

a = int(input())
if a > 0:
print('YES')
else:
print('NO')

3.2 – Is odd

a = int(input())
if a % 2 == 1:
print('YES')
else:
print('NO')

3.3 – Is even

a = int(input())
if a % 2 == 0:
print('YES')
else:
print('NO')

3.4 – Ends on seven

if int(input()) % 10 == 7:
print('YES')
else:
print('NO')

3.5 – Minimum of two numbers

https://snakifyanswers.wordpress.com 6/9
25-02-2024 12:35 Snakify Answers

a = int(input())
b = int(input())
if a < b:
print(a)
else:
print(b)

3.6 – Are both odd

a = int(input())
b = int(input())
if a % 2 == 1 and b % 2 == 1:
print('YES')
else:
print('NO')

3.7 – At least one odd

a = int(input())
b = int(input())
if a % 2 == 1 or b % 2 == 1:
print('YES')
else:
print('NO')

3.8 – Exactly one odd

a = int(input())
b = int(input())
if a % 2 == 1 and b % 2 == 0 or a % 2 == 0 and b % 2 == 1:
print('YES')
else:
print('NO')

3.9 – Sign function

x = int(input())
if x > 0:
print(1)
elif x == 0:
print(0)
else:
print(-1)

https://snakifyanswers.wordpress.com 7/9
25-02-2024 12:35 Snakify Answers

3.10 – Numbers in ascending order

a = int(input())
b = int(input())
c = int(input())
if a < b and b < c:
print('YES')
else:
print('NO')

3.11 – Is three digit

a = int(input())
if a >= 100 and a < 1000:
print('YES')
else:
print('NO')

3.12 – Minimum of three numbers

a = int(input())
b = int(input())
c = int(input())
if b >= a <= c:
print(a)
elif a >= b <= c:
print(b)
else:
print(c)

3.13 – Equal numbers

a = int(input())
b = int(input())
c = int(input())
if a == b == c:
print(3)
elif a == b or b == c or a == c:
print(2)
else:
print(0)

3.14 – Rook move

https://snakifyanswers.wordpress.com 8/9
25-02-2024 12:35 Snakify Answers

x1 = int(input())
y1 = int(input())
x2 = int(input())
y2 = int(input())
if x1 == x2 or y1 == y2:
print('YES')
else:
print('NO')

3.15 – Chess board – black square

column = int(input())
row = int(input())

if row % 2 == column % 2:
print('BLACK')
else:
print('WHITE')

3.16 – Chess board – same colour

x1 = int(input())
y1 = int(input())
x2 = int(input())
y2 = int(input())
if (x1 + y1 + x2 + y2) % 2 == 0:
print('YES')
else:
print('NO')

3.17 – Distance to closest point

Snakify Answers, Website Powered by WordPress.com.

https://snakifyanswers.wordpress.com 9/9

You might also like