Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- Name:- Aditya Gangurde
- Roll No.:- 53
- Assignment No. 1
- To calculate salary of employee given his Basic Pay to take as input from user. calculate grass pay. salary of employee let HRA be 10% of Basic Pay TA be 5% of Basic pay let employee pay professional Tax as 2% of total salary. Calculate Net salary payable after deduction
- '''
- Basic_pay = int(input("Enter basic pay: "))
- HRA = Basic_pay*0.1
- TA = Basic_pay*0.05
- Total_salary = Basic_pay + HRA + TA
- P_Tax = Total_salary*0.02
- Net_salary = Total_salary - P_Tax
- print("HRA is = ",HRA)
- print("TA is = ",TA)
- print("Total salary is = ",Total_salary)
- print("Professional tax = ",P_Tax)
- print("Net salary is = ",Net_salary)
- '''
- output:-
- Enter basic pay: 50000
- HRA is = 5000.0
- TA is = 2500.0
- Total salary is = 57500.0
- Professional tax = 1150.0
- Net salary is = 56350.0
- '''
- '''
- Name:- Aditya Gangurde
- Roll no.:- 53
- Assignment No. 2
- To accept N number from user. Compute and display maximum & minimum list, sum and average of numbers.
- '''
- sum = 0
- list = [1,2,3,4,5,6,7,8,9,10]
- for num in list:
- sum = sum +num
- average = sum / len(list)
- print ("sum of list element is : ", sum)
- print ("Average of list element is ", average )
- print ("Maximum is = ",min(list))
- print ("Minimum is = ",max(list))
- '''
- output:-
- sum of list element is : 55
- Average of list element is 5.5
- Maximum is = 1
- Minimum is = 10
- '''
- '''
- Name :- Aditya Gangurde
- Roll No. :53
- Assignment No. 3
- To Accept Student's five courses marks and compute his/her result. Student is passing if he/she scores
- marks equal to and above 40 in each course. If student scores aggregate greater than 75%,
- then the Grade is Distinction. If aggregate is 60>= and <75, then the Grade is First Division.
- If aggregate is 50>= and <60, then the Grade is Second Division. If aggregate is 40>= and
- <50, then the Grade is Third Division.
- '''
- List1 = [ ]
- for i in range (5):
- a = int(input("Enter Subject Marks: "))
- if (a<40):
- print("Fail!!! ")
- exit()
- List1.append(a)
- print ("\n")
- print (List1)
- print ("\n")
- sum = 0
- for i in range (5):
- sum = sum + List1[i]
- print("Total Marks = ",sum)
- percent = 0
- percent = float(percent)
- percent = sum/5
- print("Percentage of Student = ", percent, "%")
- if(percent>75):
- print("Grade: Distinction!!!")
- elif(percent>=60 and percent<75):
- print("Grade: First Division")
- elif(percent>=50 and percent<60):
- print("Grade: Second Division")
- elif(percent>=40 and percent<50):
- print("Grade: Third Division")
- else:
- print("Fail!!!")
- '''
- Output:-
- Enter Subject Marks: 92
- Enter Subject Marks: 87
- Enter Subject Marks: 89
- Enter Subject Marks: 94
- Enter Subject Marks: 98
- [92, 87, 89, 94, 98]
- Total Marks = 460
- Percentage of Student = 92.0 %
- Grade: Distinction!!!
- '''
- '''
- Name:-Aditya Gangurde
- Roll no.:- 53
- Assignment No. 4
- To accept a number from user and print digits of a number in a reverse order
- '''
- def Reverse_Integer(Number):
- Reverse = 0
- while(Number > 0):
- Reminder = Number %10
- Reverse = (Reverse *10) + Reminder
- Number = Number //10
- return Reverse
- Number = int(input("Please Enter any Number: "))
- Reverse = Reverse_Integer(Number)
- print("\n Reverse of entered number is = %d" %Reverse)
- '''
- output:-
- Please Enter any Number: 7264842
- Reverse of entered number is = 2484627
- '''
- '''
- Name :- Aditya Gangurde
- Rolll No. :- 53
- Asssignment No. 5
- Write a program in python that accepts a string from user and perform following operations
- 1. Calculate length of string
- 2. String reversal
- 3. Equality cheak of two strings
- 4. Cheak palindrome
- 5. Cheak substring
- '''
- str = input("Enter a string: ")
- counter = 0
- for s in str:
- counter = counter+1
- print("Length of the input string is:", counter)
- def reverse(str):
- s = ""
- for ch in str:
- s = ch + s
- return s
- print("Given String: ", str)
- print("Reversed String: ", reverse(str))
- print("Enter 'x' for exit.")
- str = input("Enter first string: ")
- if str == 'x':
- exit();
- else:
- string2 = input("Enter second string: ")
- if str == string2:
- print("\nBoth strings are equal to each other.")
- print(str,"==",string2);
- else:
- print("\nStrings are not equal.")
- print(str,"!=",string2);
- def reverse(s):
- return s[::-1]
- def isPalindrome(s):
- rev = reverse(s)
- if (s == rev):
- return True
- return False
- s = input("Enter the String : ")
- ans = isPalindrome(s)
- if ans == 1:
- print("Yes")
- else:
- print("No")
- def check(str, sub_str):
- if (str.find(sub_str) == -1):
- print("NO")
- else:
- print("YES")
- sub_str = input("Enter Sub String Which we want to cheak : ")
- check(str, sub_str)
- '''
- Output:-
- Enter a string: aditya gangurde
- Length of the input string is: 15
- Given String: aditya gangurde
- Reversed String: edrugnag aytida
- Enter 'x' for exit.
- Enter first string: aditya
- Enter second string: aditya
- Both strings are equal to each other.
- aditya == aditya
- '''
- '''
- Name:- Aditya Gangurde
- Roll no.:- 53
- Assignment No. 6
- To count total characters in file, total words in file, total lines of file and frequency of given word in the file.
- '''
- searchWord = input("Enter word to search: ")
- with open('File.txt') as infile:
- words = 0
- characters = 0
- count = 0
- for lineno,line in enumerate(infile,1):
- count = count + line.count(searchWord)
- wordslist = line.split()
- words += len(wordslist)
- characters += sum(len(words) for words in wordslist)
- print("total lines are", lineno)
- print("total words",words)
- print("total characters",characters)
- print("frequency is ",searchWord,"is ",count)
- """ Output
- Enter word to search: Hello
- total lines are 2
- total words 8
- total characters 35
- frequency is Hello is 1
- """
- """
- Name : Aditya Gangurde
- Roll No. : 53
- Assignment No. 7
- Create class EMPLOYEE for storing details (Name,Designation gender, Date of joining and Salary).
- Define function members to compute
- a) total no of employees in organisation
- b) to count of male and female employee
- c) employee with salary more than 10000
- d) employee with designation 'asst manager
- """
- class emp():
- count=0
- f_count=0
- m_count=0
- salary_count=0
- desig_count=0
- def __init__(self,name,desig,gender,doj,salary):
- self.name=name
- self.desig=desig
- self.gender=gender
- self.doj=doj
- self.salary=salary
- emp.count+=1
- if(self.gender=="F"):
- emp.f_count+=1
- else:
- emp.m_count+=1
- if(self.salary>10000):
- emp.salary_count+=1
- if(self.desig=="Asst_Manager"):
- emp.desig_count+=1
- def display_emp_count(self):
- print("There are", emp.count,"Employees in office")
- def count_gender(self):
- print("There are", emp.f_count,"female in office")
- print("There are", emp.m_count,"male in office")
- def count_salary(self):
- print("There are", emp.salary_count,"Employees in office having salary>10000")
- def count_desig(self):
- print("There are", emp.desig_count,"Employees in office with designation 'Assistant Manager'")
- e1=emp("Nimish","Asst_Manager","M","01-01-2019",10000)
- e2=emp("Aditya","Asst_Manager","M","02-02-2019",20000)
- e3=emp("Yash","Accountant","F","03-03-2019",30000)
- e4=emp("Ayushi","HR","F","04-04-2019",40000)
- e5=emp("Amey","Manager","M","05-05-2019",50000)
- e5.display_emp_count()
- e5.count_gender()
- e5.count_salary()
- e5.count_desig()
- """
- output:
- There are 5 Employees in office
- There are 2 female in office
- There are 3 male in office
- There are 4 Employees in office having salary>10000
- There are 2 Employees in office with designation 'Assistant Manager'
- """
Add Comment
Please, Sign In to add comment