Saturday 3 August 2019

Mini Project : 1) Temperature and Humidity Module 2) LCD Display with ABCD...

Assignment No: 16 Character Conversion UPPER to lower and lower to UPPER case

'''
Assignment No: 16
To copy contents of one file to other. While copying a) all full stops are to be
replaced with commas b) lower case are to be replaced with upper case c) upper case
are to be replaced with lower case.
'''

try:
fin = open("input.txt",'r') # file opening in read mode
fout = open("output.txt",'w') # file is created 

for line in fin:
line = line.swapcase() #Replace lower case with upper and upper with lower
line = line.replace(".","*") #Replace full stops with *
fout.write(line)
except:
print("File error occured")


Assignment NO: 11 To generate pseudo random numbers

'''
Assignment NO: 11
To generate pseudo random numbers.
'''

import random
try:
start = int(input("Enter start point: "))
end = int(input("Enter end point: "))
num = random.randint(start,end)
print(num)
except:
print("Enter start and end point as integer")




 

Assignment No: 10 Binary to Decimal Conversion

'''
Assignment No: 10
To input binary number from user and convert it into decimal number.
'''

def binaryToDecimal(binary): # function definition
      
    binary1 = binary 
    decimal, i, n = 0, 0, 0
    while(binary != 0): 
        dec = binary % 10
        decimal = decimal + dec * pow(2, i) 
        binary = binary//10
        i += 1
    print(decimal)     
      
  
# Driver code 
if __name__ == '__main__': 
    binaryToDecimal(100) 
    binaryToDecimal(101) 
    binaryToDecimal(1001)

Assignment No: 9 Printing Reverse No using Function

'''
Assignment No: 9
To accept a number from user and print digits of number in a reverse order using built-in function.
'''

Number = int(input("Please Enter any Number: "))    
Reverse = 0    
while(Number > 0):    
    Reminder = Number %10    
    Reverse = (Reverse *10) + Reminder    
    Number = Number //10    
     
print("\n Reverse of entered number is = %d" %Reverse)  


Assignment No: 6 Simple Calculator

'''
Assignment No: 6
To simulate simple calculator that performs basic tasks such as,
addition,
subtraction,
multiplication and division.
'''

def add(x, y): # function definition of addition
   return x + y

def subtract(x, y): # function definition of subtraction
   return x - y

def multiply(x, y): # function definition multiplication
   return x * y

def divide(x, y): # function definition of divide
   return x / y

def main():
while(1):
print("Select operation.")
print("1.Add")
print("2.Subtract")
print("3.Multiply")
print("4.Divide")

# Take input from the user 
choice = input("Enter choice(1/2/3/4):")
try:
num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))
except:
print("Enter numbers as integers")
continue

if choice == '1':
  print(num1,"+",num2,"=", add(num1,num2))

elif choice == '2':
  print(num1,"-",num2,"=", subtract(num1,num2))

elif choice == '3':
  print(num1,"*",num2,"=", multiply(num1,num2))

elif choice == '4':
  print(num1,"/",num2,"=", divide(num1,num2))
else:
  print("Invalid input")

if __name__ == '__main__':
main()


Assignment No: 4 Student Result Calculation

'''
Assignment No: 4
To accept students 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 if 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.
'''
class Student: # creation of class

def __init__(self): #  __init__() function to assign values to object properties
self.marks = []
self.passed = True

def input(self): # input function is defined using the def keyword. 
          #Self parameter is a reference to the current instance of the class, and is used to access variables that belong to the class.
try:
for i in range(5):
mark = float(input("Marks: "))
self.marks.append(mark)
if mark < 40:
self.passed = False
except:
print("Enter marks in digits.")

def grade(self): #grade function is defined
if self.passed:
average = sum(self.marks)/5
if average>75:
print("Distinction")
elif average >= 60 and 75> average:
print("First Division")
elif average >= 50 and 60> average:
print("Second Division")
else: 
print("Third Division")
else:
print("Failed")

if __name__ == '__main__':
student = Student()
student.input() # function calling
student.grade()

Assignment No: 03 Finding Max No & Min No in List Using Built-In Function

'''
Assignment No:3
To accept N numbers from user. Compute and display maximum in list, minimum in list,
sum and average of numbers using built-in function.
'''
try:
n = int(input("Enter no of elements: "))
nos_list = [] # nos_list list is created
for i in range(n): # for loop
num = int(input("Enter no: "))
nos_list.append(num) # numbers are added in nos_list list
maxNo = max(nos_list) # maximum number in list
minNo = min(nos_list) # minimum number in list
sumNos = sum(nos_list) # sum of numbers in list
average = sumNos/len(nos_list) # average of numbers in list
print('Max no is ',maxNo)
print('Min no is ',minNo)
print('Count: ',len(nos_list)) # length of list
print('Sum of nos is ',sumNos)
print('Average of nos is ',average)
except ValueError:
print('Enter n and all elements as integer.')


Assignment No: 02 Momentum calculation

'''
Assignment No: 2
To accept an object mass in kilograms and velocity in meters per second and display its momentum.
Momentum is calculated as e=mc2 where m is the mass of the object and c is its velocity.
'''

try:
mass = float(input("Enter mass in kgs: ")) # m is mass in kgs
velocity = float(input("Enter velocity in m/s: ")) # c is velocity in m/s
momentum = mass*(velocity**2) # e=mc2
print('Momentum of object is', momentum)
except ValueError:
print("Enter mass and velocity in int/float")

Assignment No : 01 Salary Calculation

'''
Assignment No: 1
To calculate salary of an employee given his basic pay (take as input from user).
Calculate gross salary of employee. Let HRA be 10 % of basic pay and TA be 5% of basic pay.
Let employee pay professional tax as 2% of total salary.
Calculate net salary payable after deductions.
'''
basic_pay = input("Enter your basic pay: ")
try:
basic_pay = float(basic_pay)
if basic_pay<0: # basic pay cannot be less than zero 
print("Basic pay can't be negative.")
exit()
hra = basic_pay*0.1 # hra is 10 % of basic pay
ta = basic_pay*0.05 # ta is 5 % of basic pay
total_salary = basic_pay + hra + ta
professional_tax = total_salary*0.02 # professional tax is 2 % of total salary
salary_payable = total_salary - professional_tax
print("Salary Payable is",salary_payable)
except ValueError:
print("Enter amount in digits.")

List Of Experiments to be complete in Practical session


   Programming and Problem Solving Laboratory (110005)
    Any 6-8 Assignments should be completed from Bellow List 





Python Notes : Topic Wise & Unit Wise




Image result for click here

                  Download Topic Wise Notes .....



                  Python Notes Unit Wise , Click Here to Download 


                              

Revised Syllabus of SPPU, Pune 2019 Pattern - Programming & Problem Salving

Image result for click here                                                 

                                             PPS Syllabus Click Here to Download.   

Microsoft’s latest Surface Pro X is now available in India

  Microsoft Surface Pro X 2020 is now available in India at a starting price of Rs 1,49,999.  Here's everything you would like to unders...