Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON ########################################## from math import floor ###################################################################### # Task 1: Given an 8-digit decimal number representing the date, # calculate the day of the week

PYTHON

########################################## from math import floor

###################################################################### # Task 1: Given an 8-digit decimal number representing the date, # calculate the day of the week # Input: 8-digit decimal number in the format of YYYYMMDD # Saturday: 0, Sunday: 1... Friday: 6 # Hint: Look at Zeller's congruence. # The floor() function may be helpful. (Ex: floor(5.5) = 5)

def getWeekday(timestamp): # TODO: Implement

###################################################################### # Task 2: For this task, you will create an encoder and decoder # for a Caesar cipher using the map function. # You may find this website helpful: # https://cryptii.com/pipes/caesar-cipher

###################################################################### # This provided helper function may be useful # Input: List of ASCII values (Ex: [72, 69, 76, 76, 79]) # Output: String (Ex. 'HELLO') ('H E L L O') def asciiToString(asciiList): return ''.join(map(chr, asciiList))

###################################################################### # Encoder # Input: A string value with all capital letters (leave everything # else as-is) and a shift value (Ex. HELLO WORLD, 3) # Output: An encoded string (Ex. KHOOR ZRUOG) # Hint: The ord() function converts single-character strings to ASCII def caesarEncoder(str, shift): # TODO: Implement

###################################################################### # Decoder # Input: A string value with all capital letters (leave everything # else as-is) and a shift value (Ex. KHOOR ZRUOG, 3) # Output: A decoded string (Ex. HELLO WORLD) # Hint: The chr() function converts ASCII to a single-character string def caesarDecoder(str, shift): # TODO: Implement

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions