write a program in python to ask salary ffrom users
Attachments:
Answers
Answered by
0
Answer:
salary = float(input('Enter Salary: '))
Explanation:
How the Syntax work?
First right side of the "=" will execute
=> float(input('Enter Salary: '))
As we know input() function takes only strings as input but we need a number. So we perform type casting here.
# first input() function executes and takes input from user as string
#Then float() function converts that string into number
#Later the whole value is assigned to left side of the "="
Here salary is a variable which stores amount of salary provided by user.
Answered by
2
Answer:-
- This is the required program for the question.
n=float(input("Enter your yearly salary: "))
tax=0
if (n<250000):
tax=n*0/100
elif (n<500000):
tax=n*10/100
else:
tax=n*20/100
print("Income tax: ",tax)
Similar questions