Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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

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_2

Step: 3

blur-text-image_3

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

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions

Question

8. Satyam Computer Services Limited

Answered: 1 week ago

Question

2. Explain how the role of training is changing.

Answered: 1 week ago

Question

7. General Mills

Answered: 1 week ago