Hi everyone, I am new to python and programming in general and I could use some help on converting an integer to a decimal (e.g. 80% to .8). Here is what I have so far but as I'm sure you can tell, it doesn't work:

elif menu_choice == 2:
                print 'You chose to calculate Short Term Disability\n'
		print 'Enter the annual salary: $'
		annual_salary = input('Annual Salary: $')
		print 'Enter the coverage percent: '
		coverage_percent = input('Coverage Percent: %')
		print 'The amount is: $',annual_salary*(coverage_percent/100)
		print_menu()

The program calculates coverage amounts for various employee benefits like LTD, STD, Life Insurance. In order to calculate STD I need to convert the percent amount to a decimal. Any ideas on what I can do here?

The simplest way would be
coverage_rate = coverage_percent /100.0

Remember an integer division behaves different then a floating-point division in most languages.

80/100 = 0
80/100.0 = 0.8

The simplest way would be
coverage_rate = coverage_percent /100.0

Remember an integer division behaves different then a floating-point division in most languages.

80/100 = 0
80/100.0 = 0.8

That worked, thanks for the help.

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.