Write a cipher program to encrypt or decrypt the given text

Assignment Help Python Programming
Reference no: EM133143737

Instructions

"This assignment is structured similarly to the labs, and as such the instructions are similar:,
" - Read each question thoroughly multiple times to ensure that you understand the requirements.,
" - Once you understand the question, code your solution in the associated code cell titled \"Your Solution\".,
" - Test your solution multiple times, with a variety of inputs---not just those found in the example runs.,
" - Keep in mind that partial attempts at solutions will likely still be worth some marks, so be sure to have a go at writing code for every task. ,

Programming Tasks

"This assignment consists of five programming tasks, with a total of 100 marks allocated between them according to their difficulty.,
",
"Take your time to read and re-read the instructions before attempting to write your solution---you can save a lot of trouble by simply having a clear understanding of the problem before touching any code."
]
},

Task 1
"For this task, you are to write a cipher program to encrypt or decrypt the given text message (`strings`). The cipher algorithm uses the pre-defined `key` and `rules` to convert the original text message (`strings`) into a ciphertext (`strings`). Specifically, the rules use the key to replace each letter of the original text message by another letter. A very simple set of rules is to replace letter $a$ with letter $z$, letter $b$ with letter $y$, letter $c$ with letter $x$, letter $d$ with letter $w$, ..., etc. For this task, you should use the following key ,
",
"`key ='xznlwebgjhqdyvtkfuompciasr'`,
",
"Based on the above `key`, letter `a` should be replaced by letter `x`, letter `b` should be replaced by letter `z`, letter `c` should be replaced by letter `n`, ..., and so on.,
"

Instructions,
",
"Your task is to write the following functions:,
"-\tThe encrypting function which accepts a list of strings and converts it into ciphertext (`strings`).,
"-\tThe decrypting function which accepts a list of ciphertext (`strings`) and retuns it back to the original strings.,
"- The menu (options) function which display the available options for the user to select:,
" `E: Encrypting function`,
" `D: Decrypting function`,
" `EX: exit`,
" ,
"-\tThe main function which involves the following:,
",
" - The key and any other parameters, variables, ...etc (if needed),
" - The input function to get input from user,
" - A loop of menu (or options) which asks the user to select either the Encrypting function, the Decrypting function or exit. The loop (menu) should be repeated unless the user selects exit option.

Task 2
"For this task, you are to re-write the given program (BMI Program) to make it more robust by raising exceptions upon invalid inputs and handling the raised exceptions."
]

Requirements,
"To achieve full marks for this task, you must follow the instructions above when writing your solution. Additionally, your solution `must adhere` to the following requirements:,
" - You **must** print the result of the `Encrypting` function (`ciphertext`) and `Decrypting function` (`original strings`) inside the `main` function. ,
" - You **must** address the scenario when an `empty` list is passed in as argument to your function. The `main` function should ask the user that the input should be non-empty strings. ,
" - You **must not** add any code outside the `main` function. "

Instructions,
"The program calculates the BMI (body mass index) of a person. A user can key-in invalid inputs, which causes the program to crash. Your task is to handle the invalid inputs and results using exception handling concepts."

Requirements,
"To achieve full marks for this task, you must follow the instructions above when writing your solution. Additionally, your solution must adhere to the following requirements:,
" - The program **must** handle all invalid inputs or results.,
" - You **must** not use if-condition to handle invalid inputs or results.,
" - You must use `EAFP` principle only,
"- You must use `try, except` and `raise` statements concepts,

Task 3
"For this task, you are to write a simple program to read data from a text file, reorder the data, and then write the reordered data into a new file."

Instructions,
"- Download the input_file.txt file into your PC's working directory (or the folder). The file is available in Programming Assignment 2 (instructions and submission) section.,
"- You need to read the data from the input file (named as input_file). The data consists of multiple-choice questions. ,
"- You should **randomly** **reorder** the choices for each question.,
"- You should write the reordered data into a new file, named as new_file.,

"1. What is the capital of Australia?<br>,
"(a) Canberra<br>,
"(b) Perth<br>,
"(c) Sydney<br>,
"(d) Melbourne<br>,
",
"And here is what it might look like, for example, after reordering the choices for each question,
",
"1. What is the capital city of Australia?<br>,
"(a) Sydney<br>,
"(b) Melbourne<br>,
"(c) Perth<br>,
"(d) Canberra<br>

Requirements,
"To achieve full marks for this task, you must follow the instructions above when writing your solution. Additionally, your solution must adhere to the following requirements:,
" - You **must** NOT change the format of the input file or the output file. ,
" - Your program **must** ready any file with any number of questions. The given file contains 4 questions only, but the program should read any file and reorder the choices regardless of the number of questions. ,
" - You **must** handle the situation if the file does not exist.,

Task 4
"For this task, you are to write code that handles the transfer of data between two mobile accounts."
Instructions,
"These days, many mobile phone plans allow us to transfer data with a friend or a family member who has a plan with the same provider. In this task, you are required to write a program that handles the transfer of data between two mobile plans (i.e., accounts). ,
",
"As this task relates to tranferring data between mobile accounts, a `MobileAccount` class has been provided, which supports receiving and sending data. A simple interactive loop has already been implemented, which allows the user to repeatedly transfer data from one account to another.,
Part A
"You are to write a function called `transfer_data` with three parameters: the amount of data to transfer in gigabytes, the account the data is coming from, and the account the data is going to. It should use the appropriate instance methods on each of the accounts to update their data balances as required.,
",
Part B
"If you tested your solution thoroughly in the previous part, you probably came across a logic error in the program---there's nothing to stop us from transferring data from an account, even if the account's data balance becomes negative! You are to fix this problem by raising an exception and preventing the account's data balance from becoming negative. You should do this by raising a `ValueError` in the appropriate place in the `MobileAccount` class.,
",
"_Hint: The order in which data is sent and received in `transfer_data` matters---the wrong order will result in the creation of free data!_,
",
Part C
"At this point, the program prevents a transfer occurring if there isn't enough data in the \"from\" account. However, simply crashing a program isn't a very nice user experience. You are to modify your program so that it handles the `ValueError` and displays `<<Error: Insufficient data>>` to the user. The program should otherwise continue as normal, with the user being asked whether they would like to perform another transaction. A failed transaction should not result in either account's data balance changing.,
",

Requirements,
"To achieve full marks for this task, you must follow the instructions above when writing your solution. Additionally, your solution must adhere to the following requirements:,
" - The `transfer_data` function **must not** directly access the `balance` instance variable of either mobile account.,
" - You **must** raise an exception from within the `MobileAccount` class if sending a certain amount of data would cause an account's data balance to become negative.,
" - You **must** specify the appropriate exception type when handling the exception.,
" - The `transfer_data` function call **must** be the only thing in your `try` block.,
" - A failed transaction **must not** change either mobile account's data balance (i.e. the total data of the accounts should never change)."

Task 5
"For this task, you are to graph the physical characteristics of penguins in different islands using Pandas and Matplotlib. The data is named as "

Instructions
"Download the `**penguins.csv**` dataset into your PC's working directory (or the folder). The dataset is available in Programming Assignment 2 (instructions and submission) section.,
",
"This task uses a dataset containing some physical measurements of three different penguin species. The data have been collected from three islands: Torgersen, Dream, and Biscoe. You can view the dataset using Microsoft Excel. Run the following code cell to load the dataset into a Pandas DataFrame and look at the first few rows. Read through the code before executing it."

Attachment:- Programming Assignment.rar

Reference no: EM133143737

Questions Cloud

What are the relevant internal costs for All-Alone : All-Alone will eliminate $25,000 of fixed overhead if it accepts the proposal. What are the relevant internal costs for All-Alone
Industry overview in canada : Required to provide an overview of the trucking industry in Canada, including key statistics that profile the industry's importance to the economy. Key statisti
Identify an ethically questionable behaviour : 1. Identify an ethically questionable behaviour or decision that you have encountered (preferably in your work or school life) you could pick an unethical behav
What would monthly cost of operatives wages in the factory : Unavoidable non-productive time is 25% of productive time and is paid £9 per hour. What would monthly cost of operatives wages in the factory
Write a cipher program to encrypt or decrypt the given text : Write a cipher program to encrypt or decrypt the given text message (`strings`). The cipher algorithm uses the pre-defined `key` and `rules` to convert
What is the process of creating a budget : What is the process of creating a budget? How is accounting related to your position as Director within a health care group practice
What amount should be accounted for in special revenue fund : Using information, what amount should be accounted for in a special revenue fund or funds - Equipment used for supplying electric power to residents $1,750,000
How much money will she have : Ximena received a gift of $69564 from her rich auntwhich she is investing at a rate of 3.1%. How much money will she have in 15 years
What amount should be reported as gross sales : Purchase returns amounted to P400000 of which P100000 was received from supplier. Under accrual, what amount should be reported as gross sales

Reviews

Write a Review

Python Programming Questions & Answers

  Advanced machine learning assignment

Advanced Machine Learning Assignment - Create a RL agent that finds a policy using (all) level 3 state information - Write a description explaining

  Add a list to keep track of all the numbers guessed

Add a list to keep track of all the numbers guessed and modularize your code. Be sure to import random at the beginning of your code.

  Write a program that prompts the user for the numerator

Write a program that prompts the user for the numerator and denominator of an improper fraction, then displays the equivalent as a mixed number.

  Calculate the count using loop and inside elseif statement

Calculate the count of (1,1),(1,0),(0,1),(0,0). But your program does not work and You don't know why. You need to use for loop and inside elseif statement.

  Determine whether the claims made by Ross Kemp

In the television documentary "Ross Kemp and the Armed Police" broadcast 6th September 2018 by ITV, multiple claims were made regarding violent crime in the UK.

  Gene Expression and DNA Methylation Assignment

Gene Expression and DNA Methylation Assignment Help and Solution - Briefly comment on the similarities and difference between the networks.

  Write a program that asks a user for a positive nonzero

Write a program that asks a user for a positive nonzero integer value. The program should use a "while loop" to get the sum from 1 up to the number entered.

  Revise function compare_files to accomplish the work describ

Revise function "build_word_index" to accomplish the specified work. Revise function "compare_files" to accomplish the work described in the comments. Test the revised program using the sample documents.

  Convert between tempe in fahrenheit and temp in celsius

Write a Python application that allows the user to convert between temperatures in fahrenheit and temperatures in celsius.

  Build a naughts and crosses game

Build a Naughts and Crosses game - explaining how the classes are related to each other. They are for explanation purpose. You can add any parameters

  Programming exercise - prime number

Programming Exercise - Prime number - write a Python program that determines whether a user's input is a prime number or not

  Perform ternary search on a python list

Modify that binary Search function so that it performs ternary search on a Python list. Your new function should find two midpointsthat dividethe list.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd