Skip to content

Instantly share code, notes, and snippets.

View mousewanderer's full-sized avatar
😵‍💫
I may be slow to respond.

Mouse Wanderer mousewanderer

😵‍💫
I may be slow to respond.
View GitHub Profile
@knu2xs
knu2xs / python-random-date.py
Last active July 17, 2023 14:15
Use python function to generate random date in given calendar year.
# 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')
@Marva82
Marva82 / Python Calculator.py
Created June 6, 2018 13:38
Python Calculator that accepts multiple inputs from a user
#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