Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7705279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:49:51+00:00 2026-05-31T23:49:51+00:00

I am working on small python payroll project where you enter employee name, wage,

  • 0

I am working on small python payroll project where you enter employee name, wage, and hours worked. When I enter decimals for the wage input, I am getting “invalid entry” because of my exception handling. Why are decimals being returned as invalid? Also, how can I loop this program so that it keeps the same 3 questions until the user types “Done”?
Any help will be greatly appreciated!
Thanks!

import cPickle

def getName():
    strName="dummy"
    lstNames=[]
    strName=raw_input("Enter employee's Name: ")
    lstNames.append(strName.title() + " \n")


def getWage():
    lstWage=[]
    strNum="0"
    blnDone=False
    while blnDone==False: #loop to stay in program until valid data is entered
        try:
            intWage=int(raw_input("Enter employee's wage: "))
            if intWage >= 6.0 and intWage <=20.0:
                lstWage.append(float(strNum)) #convert to float
                blnDone=True
            else:
                print "Wage must be between $6.00 and $20.00"
        except(ValueError): #if you have Value Error exception.  Explicit on error type
            print "Invalid entry"


def getHours():
    lstHours=[]
    blnDone=False
    while blnDone==False: #loop to stay in program until valid data is entered
        try:
            intHrs=int(raw_input("Enter number of hours worked: "))
            if intHrs >= 1.0 and intHrs <=60.0:
                blnDone=True
            else:
                print "Hours worked must be 1 through 60."
        except(ValueError): #if you have Value Error exception.  Explicit on error type
            print "Invalid entry"

def getDone():
    strDone=""
    blnDone=False
    while blnDone==False:
        try:
            srtDone=raw_input("Type \"DONE\" if you are finished entering names, otherwise press enter: ")
            if strDone.lower()=="done":
                blnDone=True
            else:
                print "Type another empolyee name"
        except(ValueError): #if you have Value Error exception.  Explicit on error type
            print "Invalid entry"


##### Mainline ########

strUserName=getName()
strWage=getWage()
strHours=getHours()
srtDone1=getDone()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:49:51+00:00Added an answer on May 31, 2026 at 11:49 pm

    You are assuming that the wage is an integer, which by definition does not have a decimal place. Try this:

    intWage=float(raw_input("Enter employee's wage: "))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on a small app engine project with python, jquery. I
I'm working on a small project, it is a web harvester created in python
I'm working on a small django project that will be deployed in a servlet
I'm working on a small Java project that now connects to a MS SQL
I'm working on a small project and I've run into a small problem. The
I am working on this small little piece in python and when I run
I'm working on a project using Python and pyGTK. I have a window whose
I'm working on making a small Python module. I want this module to return
I'm working on a small utility application in Python. The networking is gonna send
I'm working on a Python web application in which I have some small modules

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.