Write a python program called mystery that should ask you to enter the last digit of your cell phone number and also ask to enter your birth year. (Hint: Use the input command but be mindful that the value entered is a string.)
a. Multiply the cell phone digit by 2, add 5 to it, then multiply by 50 and add 1765
b. Then subtract your birth year from this expression.
c. Return the result of this expression.
This return value is a three digit number where the first digit is the cell phones last digit and the remaining two digits are your age.
e.g >>> mystery()
Enter last digit of your cell phone number: 2
Enter your year of birth: 1996
219

def mystery():
    ans1=input("Enter the last digit of your telephone number:")
    ans2=input("Enter your birth year:")
    ans=float((ans1*2)+(5*50)+1765)-float(ans2)
    return ans

Nice trick, I had to sit down and figure out how that worked or it would have bothered me for the rest of the day.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.