BIRTHDAY = "1982-09-08"
print BIRTHDAY
BIRTHDAY = "1982-09-08"
message = "I am born on {}".format(BIRTHDAY)
print message
import sys
BIRTHDAY = sys.argv[1]
message = "I am born on {}".format(BIRTHDAY)
print message
import sys
if len(sys.argv) < 2:
print "ERROR: Please provide a date"
else:
BIRTHDAY = sys.argv[1]
message = "I am born on {}".format(BIRTHDAY)
print message
import sys
from datetime import datetime
if len(sys.argv) < 2:
print "ERROR: Please provide a date"
else:
try:
BIRTHDAY = datetime.strptime(sys.argv[1], "%Y-%m-%d")
except ValueError:
print "ERROR: Please enter a correct date"
sys.exit()
message = "I am born on {}".format(BIRTHDAY.date())
print message
import sys
from datetime import datetime, date
def get_future_date(base_date, years):
future_date = date(
base_date.year + years,
base_date.month,
base_date.day
)
return future_date
if len(sys.argv) < 3:
print "ERROR: Please provide a date and an age"
else:
try:
birthday = datetime.strptime(sys.argv[1], "%Y-%m-%d")
except ValueError:
print "ERROR: Please enter a correct date"
sys.exit()
years = int(sys.argv[2])
future_date = get_future_date(birthday, years)
message = "I will turn {} on {}".format(years, future_date)
print message
var my_list = [1, 2, 3, 4]
for my_number in my_list:
if my_number == 1:
continue
print my_number
import sys
from datetime import datetime, date
def get_future_date(base_date, years):
future_date = date(
base_date.year + years,
base_date.month,
base_date.day
)
return future_date
if len(sys.argv) < 3:
print "ERROR: Please provide a date and an age"
else:
try:
birthday = datetime.strptime(sys.argv[1], "%Y-%m-%d")
except ValueError:
print "ERROR: Please enter a correct date"
sys.exit()
years = int(sys.argv[2])
years_list = range(1, years + 1, 1)
for year in years_list:
future_date = get_future_date(birthday, year)
message = "I will turn {} on {}".format(year, future_date)
print message
my_dict = {}
my_dict = {
"Martin": 33,
"Eva": 24,
}
martins_age = my_dict["Martin"]
import sys
from datetime import datetime, date
def get_weekday_name(weekday_number):
weekdays = {
1: "Monday",
2: "Tuesday",
3: "Wednesday",
4: "Thursday",
5: "Friday",
6: "Saturday",
7: "Sunday",
}
return weekdays[weekday_number]
def get_future_date(base_date, years):
future_date = date(
base_date.year + years,
base_date.month,
base_date.day
)
return future_date
if len(sys.argv) < 3:
print "ERROR: Please provide a date and an age"
else:
try:
birthday = datetime.strptime(sys.argv[1], "%Y-%m-%d")
except ValueError:
print "ERROR: Please enter a correct date"
sys.exit()
years = int(sys.argv[2])
years_list = range(1, years + 1, 1)
for year in years_list:
future_date = get_future_date(birthday, year)
weekday = get_weekday_name(future_date.isoweekday())
message = "I will turn {} on {}, {}".format(year, weekday, future_date)
print message
import sys
from datetime import datetime
if len(sys.argv) < 2:
print "ERROR: Please provide a date"
else:
BIRTHDAY = datetime.strptime(sys.argv[1], "%Y-%m-%d")
message = "I am born on {}".format(BIRTHDAY.date())
print message