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 135 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 Web-Browser
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 types(int, float, char, etc.)
Strings, arrays, structures
Sequential execution
Assignments (=,+,-,*,/,%, etc.)
Decisions and branching(if, if...else, elseif, etc.)
Functions, procedures, and calls
Loops(for, 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 logic/operations.
AND/OR/NOT
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)
H4ch3r Sp34k
Create a function that takes a string as an argument and returns a coded (h4ck3r 5p34k) version of the string.
Your code must accept user input and produce a printed output statement.
Examples:
hacker_speak("javascript is cool")"j4v45cr1pt 15 c00l"
hacker_speak("programming is fun")"pr0gr4mm1ng 15 fun"
hacker_speak("become a coder")"b3c0m34 c0d3r"
Notes:
In order to work properly, the function should replace all "a"s with 4,"e"s with 3,"i"s with 1,"o"s with 0, and "s"s with 5.
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
str.replace(old, 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:
card_hide("1234123456785678")"************5678"
card_hide("8754456321113213")"************3213"
card_hide("35123413355523")"**********5523"
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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!