This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --------- Exercise 1 | |
name = input('Enter your name: ') | |
age = int(input('Enter your age: ')) | |
year = 2019 - age + 99 | |
result = f'Hi, {name}! You will be 100 years old in {year} year.' | |
print(result) | |
number = int(input('Enter number')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ----------- Exercise 2 | |
number = int(input('Enter number: ')) | |
if number % 4 == 0: | |
print('Multiple to 4') | |
elif number % 2 == 0: | |
print('Even') | |
else: | |
print('Odd') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
num = int(input('Enter num: ')) | |
output = '' | |
b = [] | |
for i in a: | |
if i < num: | |
b.append(i) | |
output += str(i) + ' ' | |
print(output) | |
print(b) |