Ask Question

Create and combine the following 4 strings to determine the user's initial Access Code (beware of extra spaces). You will use string functions, methods, and operators for this.

1. Get the max letters/characters from the name

2. Use integer division to divide the length of the name string by 3. Use the portion of the name that starts at that position number, and includes up to the character in position 10 (see examples below)

3. Use the last 2 letters, in upper case

4. Use the third letters from the user's first and last names and the minimum character of the last name

+2
Answers (1)
  1. 20 June, 07:57
    0
    Python script for the problem is provided below

    Explanation:

    name = input ("Employee Name: ")

    hoursWorked = input ("/nHours Worked: ")

    payRate = input ("Pay Rate: $")

    hoursWorked = int (hoursWorked)

    payRate = float (payRate)

    grossPay = payRate*hoursWorked

    print ("Deduction: ")

    print ("/tFederal Withholding (10%) : $", round (grossPay*.1,2))

    print ("/tState Withholding (6%) : $", round (grossPay*.06,2))

    print ("/tTotal Deduction: $", round ((grossPay*.1+grossPay*.06),2))

    print ("Net Pay check: $", round ((grossPay - (grossPay*.1+grossPay*.06)),2))

    print ("Your new access code is: ")

    lengthOfName = len (name)

    index = int (lengthOfName/3);

    firstName = name. split (" ") [0]

    lastName = name. split (" ") [1]

    print (name[index:11]+name[len (name) - 2:len (name) ]. upper () + firstName[2]+lastName[2]+lastName[0])
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Create and combine the following 4 strings to determine the user's initial Access Code (beware of extra spaces). You will use string ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers