Question
Python 3.6.4 You have been asked to develop a method of analyzing the security PINs your customers use for their ATM and debit cards. Since
Python 3.6.4
You have been asked to develop a method of analyzing the security PINs your customers use for their ATM and debit cards. Since all PINs are 4-digit Integers, youve decided to write a Python function that calculates the weight of a PIN. To accomplish this your program must perform the following tasks: 1. Display a description of the programs purpose 2. Prompt the user for a 4-digit PIN 3. Calculate the sum of the absolute difference between each digit 4. Display the result
There are 2 functions and multiple parts to this program:
The main() function starts the program
# Display a description of the programs purpose
# Prompt the user for a 4-digit PIN
# Call the weight() function providing the 4-digit PIN as an argument
# The weight() function requires one parameter - an Integer
# Convert the Integer to a String
# Initialize variables
# Setup a for loop that uses the digits as a sequence
# Sum the differences between each digit in the Integer
# Print the calculated weight of the Integer
# Call the main() function
Example of input/output:
Examples of Input/ Output >>>main() This program determines the'weight' of a 4-digit PIN by calculating the sum of the absolute difference between each digit Enter the PIN: 1234 The PIN 1234 has a weight of: 3 >>> main ) This program determines the weight' of a 4-digit PIN by calculating the sum of the abaolute difference between each digit Enter the PIN: 9090 The PIN 9090 has a weight of: 27
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started