Question: CMSC 1 3 5 Introduction to Scripting Lab - Hacker Speak and Credit Card Hide Scope: In this lab, students will : Write and run
CMSC Introduction to Scripting
Lab Hacker Speak and Credit Card Hide
Scope:
In this lab, students will :
Write and run Python Script.
Learn how to work with strings.
Learn how to find and replace parts of a string.
Learn how recursion works in Python.
Equipment Tool Needed:
This lab requires the use of the following:
Laptop Desktop
Any version of Windows
Any WebBrowser
IDLE IDE
Lab Outcomes:
Upon completion of this lab, students will be able to:
Understand basic structures and algorithms.
Properly apply basic programming constructs and concepts including:
Variables and typesint float, char, etc.
Strings, arrays, structures
Sequential execution
Assignments etc.
Decisions and branchingif ifelse, elseif, etc.
Functions, procedures, and calls
Loopsfor while, repeat, etc.
Debugging techniques
Write simple linear scripts.
Implement basic security concepts.
Permissions, bounds checking, input validation, type checking and parameter validation.
Write simple and compound conditions within a programming language.
Basic Boolean logicoperations
ANDORNOT
Run Python Scripts.
Steps:
The following steps will be completed and submitted via a Microsoft word file along with Python source code file. Any other format will not be accepted and will result in a zero grade. Programming Labs are considered incomplete, if they do not compile and will result in a zero grade.
Check System Requirements
Check the system requirement to know whether your computer supports IDLE.
Download and Install IDLE Refer to Python Installation Lab
Hchr Spk
Create a function that takes a string as an argument and returns a coded hckr pk version of the string.
Your code must accept user input and produce a printed output statement.
Examples:
hackerspeakjavascript is cool"jvcrpt cl
hackerspeakprogramming is fun"prgrmmng fun"
hackerspeakbecome a coder"bcm cdr
Notes:
In order to work properly, the function should replace all as with es with is with os with and ss with
Hint:
Python string method replace returns a copy of the string in which the occurrences of old have been replaced with new, optionally restricting the number of replacements to max.
Syntax:
Following is the syntax for replace method
strreplaceold new max
Parameters:
old This is old substring to be replaced.
new This is new substring, which would replace old substring.
max If this optional argument max is given, only the first count occurrences are replaced.
Hiding the Card Number
Write a function that takes a credit card number and only displays the last four characters. The rest of the card number must be replaced by
Your code must accept user input and produce a printed output statement.
Be sure to include input validation condition into your program.
Examples:
cardhide
cardhide
cardhide
Notes:
Ensure you return a string.
The length of the string must remain the same as the input.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
