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
# import modules | |
import random | |
import datetime | |
# create function accepting a single parameter, the year as a four digit number | |
def get_random_date(year): | |
# try to get a date | |
try: | |
return datetime.datetime.strptime('{} {}'.format(random.randint(1, 366), year), '%j %Y') |
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
#Creating a calculator that gets multiple input from the user | |
from functools import reduce | |
def addition(*args): | |
newList = [] | |
for i in inputList: | |
z = int(i) | |
newList.append(z) | |
NumbersSum = sum(newList) | |
return NumbersSum |