0% found this document useful (0 votes)
13 views8 pages

Income Tax Calculator and Reports

The document contains a series of Python scripts that perform various tasks such as calculating income tax based on age and income, generating news reports, checking for palindromes, managing student data, and more. Each script includes user input prompts and conditional logic to handle different scenarios. The scripts demonstrate basic programming concepts like loops, conditionals, and data structures.

Uploaded by

sharma252632
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views8 pages

Income Tax Calculator and Reports

The document contains a series of Python scripts that perform various tasks such as calculating income tax based on age and income, generating news reports, checking for palindromes, managing student data, and more. Each script includes user input prompts and conditional logic to handle different scenarios. The scripts demonstrate basic programming concepts like loops, conditionals, and data structures.

Uploaded by

sharma252632
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

1.

aline's visit

print("Hello "+input("Enter the name:")+"! Welcome to our planet Earth.")

[Link] tax

age=int(input("Enter the age:\n"))

tax=0

if age>18 and age<=100:

income=int(input("Enter the income:\n"))

if income>0:

if age<=60:

if income<=250000:

tax=(income*0)/100

elif income>250000 and income<=500000:

tax=(income*10)/100

elif income>500000 and income<=1000000:

tax=(income*20)/100

elif income>1000000:

tax=(income*30)/100

elif age>60 and age<=80:

if income<=300000:

tax=(income*0)/100

elif income>300000 and income<=500000:

tax=(income*10)/100

elif income>500000 and income<=1000000:

tax=(income*20)/100

elif income>1000000:

tax=(income*30)/100

elif age>80 :

if income<=500000:

tax=(income*0)/100

elif income >500000 and income<=1000000:


tax=(income*20)/100

elif income>1000000:

tax=(income*30)/100

print("The Tax amount is: %.2f" % tax)

else:

print("Invalid Income")

else:

print("Invalid Age")

[Link] report generation

x=int(input("Dead Count:"+"\n"))

if x>=0:

y=int(input("Injured Count:"+"\n"))

if y>=0:

z=int(input("Safe Count:"+"\n"))

if z>=0:

print("TSUNAMI REPORT OF JAPAN"+"\n"+"The number of people"+"\


n"+"Dead:"+str(x)+"\n"+"Injured:"+str(y)+"\n"+

"Safe:"+str(z)+"\n"+"Please help the people who are suffering!!!")

else:

print("Invalid input")

else:

print("Invalid input")

else:

print("Invalid input")

[Link]

word=input("Enter the string:")

new_word=[Link]().replace(" ","")

if new_word[::1]==new_word[::-1]:

print("Yes, the string is a palindrome!")

else:
print("No, the string is not a palindrome!")

[Link] Student Data

n=int(input("Enter the no of student details to be created : "))

data=[]

subdict={}

if n>0:

for i in range(n):

name=input("Name: ")

age=int(input("Age: "))

if age<10 or age>20:

print("Invalid Input")

exit()

location=input("Location: ")

[Link]({'Name':name,'Age':age,'Location':location})

[Link](subdict)

subdict={}

print("Here's the list of student details :")

for i in data:

print(i)

sn=input("Enter the training location: ")

res=[sub['Name'] for sub in data if sub['Location']==sn]

if not res:

print("Invalid location")

else:

print("Student(s) enrolled in this training location:")

for i in res:

print(i)

else:

print("Invalid Input")
[Link] protection

n1=int(input("Enter the total [Link] plots: "))

f=e=o=0

l=[]

if n1<=20 and n1>=1:

print("Enter the numbers of each plot")

for i in range(n1):

i=int(input())

if i<=0:

print("Invalid Input")

exit()

[Link](i)

o=(sum([i for i in l if i%2!=0]))

e=sum([i for i in l if i%2==0])

avg=float((e+o)/2)

print("The password for the file is: %.2f" % avg)

else:

print("Invalid Input")

[Link] or fail

n=int(input("Enter the no. of subjects: "))

l=[]

f=0

p=0

if n>0:

print("Enter the marks:")

for i in range(n):

i=int(input())

if i>=0 and i<=100:

[Link](i)

else:
print("Invalid mark")

exit()

for i in l:

if i<=50:

f=f+1

else:

p=p+1

print("No. of subjects passed:",p)

print("No. of subjects failed:",f)

else:

print("Invalid no. of subjects")

[Link]'s online courses

n=int(input("Enter number of courses: "))

d={}

if n>=1:

for i in range(n):

print("Enter name of the subject and mark respectively:")

name=input()

mark=int(input())

if mark<0 or mark>100:

print("Invalid mark")

exit()

d[name]=mark

print("The courses you have cleared are:")

for key,value in [Link]():

if value>=80 and value<=100:

print(key,value)

else:

print("Invalid no. of courses")


[Link] names

names = []

print("Enter the number of names:")

number = int(input())

if(number<=0):

print("Invalid Input")

else:

print("Enter the names:")

for i in range(number):

name = input()

[Link](name)

[Link](reverse = True)

[Link](reverse=True,key=len)

print("The sorted name list is:")

for i in range(number):

print(names[i])

[Link] student data

n=int(input("Enter number of students: "))

file=open('output_data.txt','w')

for i in range(1,n+1):

print("Student"+str(i))

name=input("Enter name: ")

score=input("Enter the score: ")

line="Name: "+name+" "+"Score: "+score

[Link](line+"\n")

[Link]()

[Link] composer

def find_prime(start,end):

count=0

for num in range(start_number,end_number+1):


if num>1:

for i in range(2,num):

if(num%i)==0:

break

else:

print(num,end=" ")

count=count+1

if count==0:

print("There is no prime numbers in this range")

start_number=int(input())

end_number=int(input())

if start_number<0 or end_number<0 or start_number>end_number:

print("Invalid range")

elif start_number==end_number:

print("There is no prime numbers in this range")

else:

find_prime(start_number,end_number)

[Link] the file

print(

'''

Aerosol - 38

Churn - 50

Plank - 55

Slipsheet - 75

Jerrican - 950

Girder - 100

'''

)
[Link]

import greet
n=input("Enter the senior's name: ")
[Link](n)

[Link]

def greet(name):
print(message+" Mr."+name+", Welcome to the farewell Party!!!")
print("Documentation string: Module for Greeting")
message="Hello"
_init_.py
blank rakh

[Link]

import calendar
def is_leap(year):
return ( year%4==0 and year % 100!=0 )or year % 400 == 0
def month_name(no):
#date=[Link]()
return calendar.month_name[no]
def days_in_month(month,year):
return [Link](year,month)[1]

time_table.py

from Dates import *


year=int(input("Enter year as 4 digits (e.g: 2002):"))
month=int(input("Enter month number:"))
print("Year:", ("Leap Year") if is_leap(year) else "Not Leap Year")
print("Month Name: ",month_name(month))
print("Days in month: ",days_in_month(month,year))

Common questions

Powered by AI

The script initially asks for numerical input for dead, injured, and safe counts in sequence, each validated by checking whether the entered value is non-negative. If any input is negative, it outputs 'Invalid input' and stops execution. This ensures only valid numerical data is processed, albeit without specific error handling or user feedback on what was incorrect .

To enhance the 'Average names' section for more complex criteria, additional sorting criteria such as case-insensitivity, ignoring special characters, or including multi-level sorting (e.g., length, then alphabetical) can be incorporated. Furthermore, integrating third-party libraries for natural language sorting could optimize the process. This would increase complexity but offer more robust sorting, potentially useful in varied applications needing specific ordering .

The rhythm composer uses a nested loop that iterates through the given range, marking numbers as non-prime if they are divisible by any number other than 1 and themselves. The limitations of this approach are its inefficiency for larger numbers due to checking all integers from 2 to num-1, which can be optimized by checking up to the square root of the number and excluding even numbers beyond 2. The script is functional for small ranges but could slow significantly with larger inputs .

Student data is input by age, name, and location within a loop to create multiple entries. Each student's details are stored in a temporary dictionary which is then appended to a list. This list is used to search for students by training location. If an entry matches the training location, their names are displayed; otherwise, an 'invalid location' message is returned. This indicates a system based on simple filtering of a structured list, lacking persistent storage beyond execution .

In the 'average names' function, the list of names input by the user is sorted by length in descending order, followed by reverse alphabetical order. Input validation exists to ensure a positive number of names is taken, with immediate termination upon invalid input. This dual sorting employs Python's list methods, efficiently organizing names by two criteria for organized retrieval .

The password protection segment calculates a password by first collecting the size of integer plots within a defined limit (1-20), summing even and odd integers separately, and finding the average of both sums. This average is used as a password, formatted to two decimal places. Invalid inputs are filtered by ensuring each plot number is positive; otherwise, execution is halted .

The 'pass or fail' assessment includes basic error handling by validating both the number of subjects and the marks input. Grades are accepted only if they fall within the range [0-100]. If out-of-range marks or subjects counts are detected, the function prints 'Invalid mark' or 'Invalid no. of subjects' and terminates execution. This preemptive validation prevents erroneous data from contaminating the results, albeit without logging or recovery mechanisms .

The purpose of the prime number function is to identify and print all prime numbers in a given range. Error handling is evident where the function validates the input range; it checks for negative numbers and ensures the start number is less than the end number, prompting an 'Invalid range' message otherwise. The function does not print primes if the range boundaries are equal, handling boundaries effectively though not optimizing computation .

The palindrome checker implementation could encounter issues if the input is capitalized or contains spaces, without the handling of such cases as intended. The script transforms the string to lowercase and removes spaces before checking. However, it does not account for non-alpha characters which might affect palindrome status in different contexts .

The script calculates income tax differently based on three age groups: under 60, between 60 and 80, and over 80. For individuals under 60, the tax slabs are: 0% for income up to 250,000, 10% for income between 250,001 to 500,000, 20% for income between 500,001 to 1,000,000, and 30% for income over 1,000,000. For those aged between 60 and 80, the slabs are slightly adjusted: 0% for income up to 300,000, and the rest of the slabs remain the same. For individuals over 80, the tax-free slab increases to 500,000, with 20% tax for income between 500,001 to 1,000,000, and 30% for income beyond that .

You might also like