Sei sulla pagina 1di 2

LOGATE ACADEMY JUNIOR

Solved problems and Homework


Solved problems Write a program that will check if a number is
larger or smaller than 200.
Problem 1.
Write a program that will check if a number is
larger or smaller than 100. Problem 2.
Solution: Write a program that will check if a number is
positive or negative.
a=int(input())
if a>100:
print('Number is larger than 100')
else: Problem 3.
print('Number is smaller than 100')
Write a program that will check which of the
two numbers is smaller.
Problem 2.
Problem 4.
Write a program that checks if two numbers Write a program that inputs rectangle sides.
are equal or not. Calculate circumference and area of the given
Solution: rectangle. Print 'True' if area is bigger than
circumference, and 'False' if it's not the case.
a=int(input())
b=int(input())
if a==b:
print('Numbers are equal') Problem 5.
else: Calculate the average of the three given
print(' Numbers are different')
numbers.
Problem 6.
Problem 3.
Write a program that solve equation 𝑎 ⋅ 𝑥 = 𝑏.
Write a program that inputs number of Because we can not divide with 0 (zero),
kilometers and prints the number of metres, divide our problem in two possible cases:
centimeters and millimeters. First case: 𝑎 = 0
Solution: In this case, just print: 'Not possible'.
Second case: 𝑎 ≠ 0.
km=int(input()) In this case, solve the given equation.
m=km*1000
cm=m*100 Problem 4.
mm=cm*10
print('Required number of m is:',m) Check if a given number is odd or even.
print('Required number of cm is:',cm)
print('Required number of m is:',mm) Solution:
Homework We will use our new command mod, in Python
Problem 1. it's this sign - % . This command returns the
remainder when we divide two numbers.
For example: 10%2 = 0, because when we
divide 10 with 2, there is no remainder. Also,
5%2 = 1, because when we divide 5 with 2 we
get the remainder 1.
We will use this to solve our problem.

a=int(input())
if a%2==0:
print('Number is even.')
else:
print('Number is odd')

Problem 7.
Check if a given number when divided with
three, gives a remainder 1.
If it's true, print 'True', else print 'False'.

Problem 8.
Sum two numbers if they are both even
numbers. If they are not, then multiply these
two numbers.

Potrebbero piacerti anche