Skip to content

Instantly share code, notes, and snippets.

@azdafirmansyah
azdafirmansyah / Ex2OddOrEven.py
Created November 22, 2017 09:23
Challange - Odd Or Even
#Ask the user for a number. Depending on whether the number is even or odd, print out an appropriate message to the user.
#If the number is a multiple of 4, print out a different message.
#Ask the user for two numbers: one number to check (call it num) and one number to divide by (check). If check divides evenly into num, tell that to the user. If not, print a different appropriate message.
while True:
try:
num = int(input("Please input number : "))
check = int(input("Please input divide number :"))
if num % 4 == 0:
@azdafirmansyah
azdafirmansyah / Ex1CharacterInput.py
Last active November 22, 2017 07:45
Challenge - Character Input
#Create a program that asks the user to enter their name and their age.
#Print out a message addressed to them that tells them the year that they will turn 100 years old.
from datetime import datetime
current_year = datetime.now().year
while True:
try:
name = str(input("Name :"))
if len(name) == 0: