Skip to content

Instantly share code, notes, and snippets.

@Ammly
Created July 24, 2017 15:01
Show Gist options
  • Save Ammly/6adbd34fc049afd1fb8063ce65ffd0bf to your computer and use it in GitHub Desktop.
Save Ammly/6adbd34fc049afd1fb8063ce65ffd0bf to your computer and use it in GitHub Desktop.
Tech Academy python 101
# 100th birthday
def task1():
name = str(input("Enter your name: "))
age = int(input("Enter your age: "))
yearsToHundred = (100 - age) + 2017
print("Hello %s, you will turn hundred years old in %d." % (name, yearsToHundred))
task1()
# Check if entered number is Odd or Even
def task2():
num = int(input("Enter Number to check: "))
if num % 2 == 0:
print("%d is an even number." %num)
else:
print("%d is an odd number." %num)
task2()
# print nums less < 5
def all_less_than_five(list = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]):
for i in list:
if i < 5:
print(i)
all_less_than_five()
# palindrome or not
a = str(input("Enter to check palindrome:"))
def palindrome():
#reverse the put.
b = a[::-1]
if a == b:
print("%s is palindrome." %a)
else:
print("%s is not palindrome." %a)
palindrome()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment