Complete the function which returns the weekday according to the input number:

* `1` returns `"Sunday"`
* `2` returns `"Monday"`
* `3` returns `"Tuesday"`
* `4` returns `"Wednesday"`
* `5` returns `"Thursday"`
* `6` returns `"Friday"`
* `7` returns `"Saturday"`
* Otherwise returns `"Wrong, please enter a number between 1 and 7"`

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def whatday(num):
	

Solutions:
WEEKDAY = {1: 'Sunday', 2: 'Monday', 3: 'Tuesday', 4: 'Wednesday', 5: 'Thursday', 6: 'Friday', 7: 'Saturday'}
ERROR = 'Wrong, please enter a number between 1 and 7'

def whatday(n):
	return WEEKDAY.get(n, ERROR)


def whatday(num):
	switcher = {1: 'Sunday', 2: 'Monday', 3: 'Tuesday', 4: 'Wednesday', 5: 'Thursday', 6: 'Friday', 7: 'Saturday'}
	return switcher.get(num, 'Wrong, please enter a number between 1 and 7')


def whatday(num):
	days = ('Sun', 'Mon', 'Tues', 'Wednes', 'Thurs', 'Fri', 'Satur')
	return days[num - 1] + 'day' if 0 < num < 8 else 'Wrong, please enter a number between 1 and 7'


whatday = lambda n: 'Wrong, please enter a number between 1 and 7' * (n > 7 or n < 1) or __import__('calendar').day_name[n - 2]


WEEK = ' Sunday Monday Tuesday Wednesday Thursday Friday Saturday'.split(' ')

def whatday(n):
	return WEEK[n] if 0 < n < 8 else 'Wrong, please enter a number between 1 and 7'


def whatday(num):
	days = {1: 'Sunday', 2: 'Monday', 3: 'Tuesday', 4: 'Wednesday', 5: 'Thursday', 6: 'Friday', 7: 'Saturday'}
	if num not in days:
		return 'Wrong, please enter a number between 1 and 7'
	return days[num]


def whatday(num):
	weekday = {1: 'Sunday', 2: 'Monday', 3: 'Tuesday', 4: 'Wednesday', 5: 'Thursday', 6: 'Friday', 7: 'Saturday'}
	try:
		return weekday[num]
	except:
		return 'Wrong, please enter a number between 1 and 7'


def whatday(num):
	lst = ['Wrong, please enter a number between 1 and 7', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
	return lst[num] if num > 0 and num < 8 else lst[0]


def whatday(num):
	l = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
	if 0 < num <= 7:
		for i in range(1, 8):
			if i == num:
				return l[i - 1]
	else:
		return 'Wrong, please enter a number between 1 and 7'


def whatday(num):
	return ('Wrong, please enter a number between 1 and 7', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday')[1 <= num <= 7 and num]


from datetime import datetime

def whatday(n):
	return datetime(2019, 2, 2 + n).strftime('%A') if 1 <= n <= 7 else 'Wrong, please enter a number between 1 and 7'


def whatday(num):
	return dict(zip('2345671', __import__('calendar').day_name)).get(str(num), 'Wrong, please enter a number between 1 and 7')


def whatday(numb):
	if numb not in range(1, 8):
		return 'Wrong, please enter a number between 1 and 7'
	elif numb == 1:
		return 'Sunday'
	elif numb == 2:
		return 'Monday'
	elif numb == 3:
		return 'Tuesday'
	elif numb == 4:
		return 'Wednesday'
	elif numb == 5:
		return 'Thursday'
	elif numb == 6:
		return 'Friday'
	elif numb == 7:
		return 'Saturday'


def whatday(n):
	if n < 1 or n > 7:
		return 'Wrong, please enter a number between 1 and 7'
	return ' Sunday Monday Tuesday Wednesday Thursday Friday Saturday'.split(' ')[n]


L = {1: 'Sunday', 2: 'Monday', 3: 'Tuesday', 4: 'Wednesday', 5: 'Thursday', 6: 'Friday', 7: 'Saturday'}
whatday = lambda n: L.get(n, 'Wrong, please enter a number between 1 and 7')


def whatday(num):
	day = ['Wrong, please enter a number between 1 and 7', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
	try:
		return day[num]
	except:
		return day[0]


def whatday(num):
	days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
	if num > 7 or num <= 0:
		return 'Wrong, please enter a number between 1 and 7'
	for (index, x) in enumerate(days, 1):
		if num == index:
			return x


whatday = lambda n: 'SMTWTFSuouehranneduit  snr u   es r   s'[n - 1::7].rstrip() + 'day' if 0 < n < 8 else 'Wrong, please enter a number between 1 and 7'


import calendar
from collections import deque

def whatday(num: int) -> str:
	days = deque(list(calendar.day_name))
	days.rotate(1)
	return dict(zip(list(range(1, 8)), days)).get(num, 'Wrong, please enter a number between 1 and 7')


def whatday(num):
	if 1 <= num <= 7:
		if num == 1:
			return 'Sunday'
		elif num == 2:
			return 'Monday'
		elif num == 3:
			return 'Tuesday'
		elif num == 4:
			return 'Wednesday'
		elif num == 5:
			return 'Thursday'
		elif num == 6:
			return 'Friday'
		else:
			return 'Saturday'
	else:
		return 'Wrong, please enter a number between 1 and 7'


def whatday(num):
	day = ['Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']
	return day[num % 7] if num in range(1, 8) else 'Wrong, please enter a number between 1 and 7'


import calendar

def whatday(n):
	if not 1 <= n <= 7:
		return 'Wrong, please enter a number between 1 and 7'
	return calendar.day_name[(n - 2) % 7]


def whatday(num):
	week = {1: 'Sunday', 2: 'Monday', 3: 'Tuesday', 4: 'Wednesday', 5: 'Thursday', 6: 'Friday', 7: 'Saturday'}
	if num in week.keys():
		return week.get(num)
	else:
		return 'Wrong, please enter a number between 1 and 7'


def whatday(num):
	d = {1: 'Sunday', 2: 'Monday', 3: 'Tuesday', 4: 'Wednesday', 5: 'Thursday', 6: 'Friday', 7: 'Saturday'}
	return d.get(num) if num > 0 and num < 8 else 'Wrong, please enter a number between 1 and 7'


from calendar import day_name

def whatday(n):
	return 'Wrong, please enter a number between 1 and 7' if n > 7 or n < 1 else day_name[n - 2]


from calendar import day_name

def whatday(num):
	d = {}
	c = 2
	for i in list(day_name):
		if i == 'Sunday':
			d[1] = i
		else:
			d[c] = i
		c += 1
	return d.get(num, 'Wrong, please enter a number between 1 and 7')


def whatday(num):
	dic = {'Sunday': 1, 'Monday': 2, 'Tuesday': 3, 'Wednesday': 4, 'Thursday': 5, 'Friday': 6, 'Saturday': 7}
	for (key, value) in list(dic.items()):
		if dic[key] == num and num <= 7:
			return key
	return 'Wrong, please enter a number between 1 and 7'


def whatday(num):
	nums = [1, 2, 3, 4, 5, 6, 7]
	days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
	d_o_w = dict(list(zip(nums, days)))
	if num in list(d_o_w.keys()):
		return d_o_w[num]
	else:
		return 'Wrong, please enter a number between 1 and 7'


import calendar

def whatday(num):
	ll = ['Sunday'] + list(calendar.day_name)[:-1]
	print(num, ll)
	return ll[num - 1] if num in range(1, 8) else 'Wrong, please enter a number between 1 and 7'


def whatday(num):
	try:
		a = zip(range(1, 8), ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'])
		adict = dict(a)
		return adict[num]
	except:
		return 'Wrong, please enter a number between 1 and 7'


def whatday(num):
	if num <= 0 or num > 7:
		return 'Wrong, please enter a number between 1 and 7'
	weekdays = ['', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
	return weekdays[num]


def whatday(num):
	days = {1: 'Sunday', 2: 'Monday', 3: 'Tuesday', 4: 'Wednesday', 5: 'Thursday', 6: 'Friday', 7: 'Saturday'}
	try:
		return days[num]
	except KeyError as e:
		return 'Wrong, please enter a number between 1 and 7'


def whatday(Vaðlaheiðarvegavinnuverkfærageymsluskúraútidyralyklakippuhringur):
	if Vaðlaheiðarvegavinnuverkfærageymsluskúraútidyralyklakippuhringur == 1:
		return 'Sunday'
	elif Vaðlaheiðarvegavinnuverkfærageymsluskúraútidyralyklakippuhringur == 2:
		return 'Monday'
	elif Vaðlaheiðarvegavinnuverkfærageymsluskúraútidyralyklakippuhringur == 3:
		return 'Tuesday'
	elif Vaðlaheiðarvegavinnuverkfærageymsluskúraútidyralyklakippuhringur == 4:
		return 'Wednesday'
	elif Vaðlaheiðarvegavinnuverkfærageymsluskúraútidyralyklakippuhringur == 5:
		return 'Thursday'
	elif Vaðlaheiðarvegavinnuverkfærageymsluskúraútidyralyklakippuhringur == 6:
		return 'Friday'
	elif Vaðlaheiðarvegavinnuverkfærageymsluskúraútidyralyklakippuhringur == 7:
		return 'Saturday'
	return 'Wrong, please enter a number between 1 and 7'


def whatday(n):
	if 0 < n < 8:
		return ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'][n - 1].title()
	else:
		return 'Wrong, please enter a number between 1 and 7'


def whatday(num):
	err = 'Wrong, please enter a number between 1 and 7'
	try:
		return [err, 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][int(num)]
	except:
		return err


def whatday(num):
	print(num)
	days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
	return days.pop(num - 1) if num <= len(days) and num > 0 else 'Wrong, please enter a number between 1 and 7'