google.com, pub-6167773875660516, DIRECT, f08c47fec0942fa0 1st PUC COMPUTER SCIENCE LAB PROGRAMS PDF | class 11 computer science lab manual | 1st puc computer science programs - 2nd puc computer science

1st PUC COMPUTER SCIENCE LAB PROGRAMS PDF | class 11 computer science lab manual | 1st puc computer science programs

 1st PUC COMPUTER SCIENCE LAB PROGRAMS PDF,1ST PUC COMPUTER SCIENCE LAB MANUAL,1ST PUC COMPUTER SCIENCE LAB MANUAL PDF, 1ST PUC COMPUTER SCIENCE LAB,1st puc computer science lab manual,1st puc computer science lab programs,1st puc computer science lab programs pdf,1st puc computer science lab manual pdf,1st puc computer lab manual pdf,1st puc lab manual computer science,1st puc lab manual computer science python,class 11 computer science lab manual pdf,class 11 computer science lab manual,class 11 computer science lab manual python,class 11 computer science practicals with solutions,class 11 computer science lab manual python free download,class 11 computer science lab manual python pdf download,class 11 computer science lab manual python pdf,class 11 computer science lab manual python pdf free download,1st puc computer science programs

        1.       Write a program to swap two numbers using a third variable.

Write a program to swap two numbers using a third variable.


a=int(input("Enter the value of a:"))

b=int(input("Enter the value of b:"))

print("Before swapping a=",a," and b=",b)

temp=a

a=b

b=temp

print("After swapping a=",a," and b=",b)

Watch Explainer Video Here
1st puc computer science lab programs






1.           2. Write a program to enter two integers and perform all arithmetic operations on them.

2.	Write a program to enter two integers and perform all arithmetic operations on them.


a=int(input("Enter the value of a:"))

b=int(input("Enter the value of b:"))

sum=a+b

diff=a-b

prod=a*b

divi=int(a/b)

modulus=a%b

print("Addition=", sum)

print("Subtraction=",diff)

print("Multiplication=",prod)

print("Division=",divi)

print("Modulus=",modulus)

Watch Explainer Video Here

1st puc computer science lab programs


1.           3. Write a Python program to accept length and width of a rectangle and compute its perimeter and area.

3.	Write a Python program to accept length and width of a rectangle and compute its perimeter and area



l=float(input("Enter the length of the rectangle:"))

w=float(input("Enter the width of the rectangle:"))

area=l*w

perimeter=2*(l+w)

print("Area of rectangle=",area)

print("Perimeter of rectangle=",perimeter)

1st puc computer science lab programs


        4.  Write a python program to calculate the amount payable if money has been lent on simple interest. Principal or money lent=P, Rate of interest =R% per annum and Time =T years. Then simple interest (SI) =PxTxR/100. Amount payable=Principal+SI. P,R and T are given as input to the program.

simple interest


p=float(input("Enter the principal amount:"))

t=float(input("Enter the time:"))

r=float(input("Enter the rate of interest:"))

si=p*t*r/100

print("Simple Interest=",si)

Watch Explainer Video Here

1st puc computer science lab programs


1.           5. Write a program to find the largest among three numbers.

5.	Write a program to find the largest among three numbers.


a=float(input("Enter the value of a:"))

b=float(input("Enter the value of b:"))

c=float(input("Enter the value of c:"))

if(a>=b)and(a>=c):

              large=a

elif(b>=a)and(b>=c):

    large=b

else:

              large=c

print("The largest number=",large)

Watch Explainer Video Here

1st puc computer science lab programs


      

    6. Write a program that takes the name and age of the user as input and displays a message whether the user is eligible to apply for a driving license or not. (The eligible age is 18 years).

6.	Write a program that takes the name and age of the user as input and displays a message whether the user is eligible to apply for a driving license or not


name=input("Enter your name: ")

age=int(input("Enter your age: "))

if age>=18:

              print("Hello, ",name," ! You are eligible.")

else:

              print("Sorry, ",name,". You are not eligible yet.")

Watch Explainer Video Here

1st puc computer science lab programs


      

    7. Write a program that prints minimum and maximum of five numbers entered by the user.

    

7.	Write a program that prints minimum and maximum of five numbers entered by the user.

small=0

large=0

for i in range(0,5):

    a=int(input("Enter the number "+str(i+1)+":"))

    if i==0:

        small=large=a

    if(a<small):

        small=a

    if(a>large):

        large=a

print("Smallest number=",small)

print("Largest number=",large)

Watch Explainer Video Here
1st puc computer science lab programs


        8. Write a python program to find the grade of a student when grades are allocated as given in the table below.

Above 90%         A

80% to 90%        B

70% to 80%        C

60% to 70%        D

Below 60%         E

Percentage of the marks obtained by the student is input to the program.

8.	Write a python program to find the grade of a student

 

p=float(input("Enter the percentage: "))

if(p>90):

              print("Grade A")

elif(p>80):

              print("Grade B")

elif(p>70):

              print("Grade C")

elif(p>60):

              print("Grade D")

else:

              print("Grade E")

Watch Explainer Video Here

1st puc computer science lab programs


1.       9. Write a function to print the table of a given number. The number has to be entered by the user.

9.	Write a function to print the table of a given number. The number has to be entered by the user


a=int(input("Enter the number: "))

i=1

while i<=10:

              b=a*i

              print(a,'x',i,'=',b)

              i=i+1

Watch Explainer Video Here

1st puc computer science lab programs


1.       10. Write a program to find the sum of digits of an integer number, input by the user.

10.	Write a program to find the sum of digits of an integer number, input by the user


n=int(input("Enter the number: "))

sum=0

while n>0:

              rem=n%10

              sum=sum+rem

              n=n//10

print("The sum of digits=",sum)

Watch Explainer Video Here

1st puc computer science lab programs


1.       11. Write a program to check whether an input number is a palindrome or not.

11.	Write a program to check whether an input number is a palindrome or not.


n=int(input("Enter a number: "))

temp=n

rev=0

while(n>0):

              digit=n%10

              rev=rev*10+digit

              n=n//10

if(temp==rev):

              print("It is a palindrome")

else:

              print("It is not a palindrome")

Watch Explainer Video Here

1st puc computer science lab programs


1.       12. Write a program to print the following patterns:

1 2 3 4 5

1 2 3 4

1 2 3

1 2

1

12.	Write a program to print the following patterns


n=int(input("Enter the number of rows: "))

for i in range(n,0,-1):

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

                  print(j,end=' ')

    print()

Watch Explainer Video Here

1st puc computer science lab programs


1.       13. Write a program that uses a user defined function that accepts name and gender (as M for male, F for Female) and prefixes Mr./Ms. Based on the gender.

13.	Write a program that uses a user defined function that accepts name and gender


def  student(name,gender):

              if(gender=='M' or gender=='m'):

                             print('Mr.',name)

              elif(gender=='F' or gender=='f'):

                             print('Ms.',name)

              else:

                             print("Please enter only M or F in gender")

name=input("Enter the name: ")

gender=input("Enter the gender M for Male and F for Female: ")

student(name,gender)

Watch Explainer Video Here

1st puc computer science lab programs


1.       14. Write a program that has a user defined function in accept the coefficients of a quadratic equation in variables and calculates its determinant. For example : if the coefficients are stored in the variables a,b,c then calculate determinant as b2 – 4ac. Write the appropriate condition to check determinants on positive, zero and negative and output appropriate result.

14.	Write a program that has a user defined function in accept the coefficients of a quadratic equation


a=int(input("Enter the value of a: "))

b=int(input("Enter the value of b: "))

c=int(input("Enter the value of c: "))

def disc(a,b,c):

              d=b**2-4*a*c

              return d

det=disc(a,b,c)

if(det>0):

              print("The roots are real and different")

elif(det==0):

              print("The roots are real and equal")

else:

              print("The roots are imaginary")

Watch Explainer Video Here

1st puc computer science lab programs


1.       15. Write a program that has a user defined function to accept 2 numbers as parameters, if number  is less than number 2 then numbers are swapped and returned, i.e., number 2 is returned in place of number 1 and number 1 is reformed in place of number 2, otherwise the same order is returned.

15.	Write a program that has a user defined function to accept 2 numbers as parameters


def swap(a,b):

              if(a<b):

                             return b,a

              else:

                             return a,b

a=int(input("Enter the value of a: "))

b=int(input("Enter the value of b: "))

print("Before swapping a=",a," and b=",b)

a,b=swap(a,b)

print("After swapping a=",a," and b=",b)

Watch Explainer Video Here
1st puc computer science lab programs


16. Write a program to input line(s) of text from the user until enter is pressed. Count the total number of characters in the text (including white spaces), total number of alphabets, total number of digits , total number of special symbols and total number of words in the text. (Assume that each \word is separated by one space).


16.	Write a program to input line(s) of text from the user until enter is pressed




string=input("Enter the string:")
l=len(string)
alpha=digit=special=0
words=1
for ch in string:
    if ch.isalpha():
        alpha+=1
    elif ch.isdigit():
        digit+=1
    elif ch.isspace():
        words+=1
    else:
        special+=1
print("Total number of characters:",l)
print("Total number of alphabets:",alpha)
print("Total number of digits:",digit)
print("Total number of Special Symbols:",special)
print("Total number of words:",words)

1st puc computer science lab programs



17.  Write a user defined function to convert a string with more than one word into title case string where string is passed as parameter. (Title case means that the first letter of each word is capitalized)
17.	Write a user defined function to convert a string with more than one word into title case



        def student(s):

    s1=s.title()

    print("The input string in title case is:",s1)

 

name=input("Enter the string:")

space=0

for b in name:

    if b.isspace():

        space+=1

if name.istitle():

    print("The string is already in title case")

elif space>0:

    student(name)

else:

    print("The string is in one word")

        
1st puc computer science lab programs



18. 
Write a function that takes a sentence as an input parameter where each word in the sentence is separated by a space. The function should replace each blank with a hyphen and then return the modified sentence.
18.	Write a function that takes a sentence as an input parameter where each word in the sentence is separated by a space





                def replace1(s):

                    return s.replace(' ','-')

                s1=input("Enter the sentence:")

                s2=replace1(s1)

                print("The modified sentence=",s2)

            Watch Explainer Video Here

1st puc computer science lab programs


            19.   Write a program to fund the number of times an element occurs in the list.

        

19.	Write a program to find the number of times an element occurs in the list

            list=[10,20,10,40,50,30,10,10,50]

            print("Elements in the list are:",list)

            a=int(input("Enter the number to check how many times the element occurs in the list:"))

            b=list.count(a)

            print("An element ",a," is present ",b," times")

            Watch Explainer Video Here

            

1st puc computer science lab programs


            20. Write a function that returns the largest element of the list passed as parameter.

                

20.	Write a function that returns the largest element of the list passed as parameter

                

                def large(list):

                    n=0

                    for i in range(len(list)):

                        if(i==0 or list[i]>n):

                            n=list[i]

                    return n

                list=[10,20,30,40,50,60,70,80,90,100]

                max=large(list)

                print("The elemtns of the list are:",list)

            print("The largest number=",max)
                
                Watch Explainer Video Here
                
1st puc computer science lab programs



21. 
Write a program to read a list of elements. Modify this list so that it does not contain any duplicate elements, i.e. all elements occurring multiple times in the list should appear only once.

all elements occurring multiple times in the list should appear only once





all elements occurring multiple times in the list should appear only once



                def dup(list):

                    newlist=[]

                    for a in range(len(list)):

                        if list[a] not in newlist:

                            newlist.append(list[a])

                    return newlist

 

                list=[]

                n=int(input("How many elements?"))

                print("Enter the elements:")

                for i in range(n):

                    a=int(input())

                    list.append(a)

                print("The numbers in list:",list)

                print("List without duplicate elements is:",dup(list))

                Watch Explainer Video Here

                

1st puc computer science lab programs


                22. Write a program to read email IDs of n number of students and store them in a tuple. Create two new tuples, one to store only the usernames from the email IDs and second to store domain names from the email IDs. Print all three tuples at the end of the program. [Hint: You may use the function split()]

22.	Write a program to read email IDs of n number of students and store them in a tuple


                email=tuple()

                username=tuple()

                domainname=tuple()

                n=int(input("How many valid email IDs you want to enter? "))

                for i in range(n):

                    eid=input("Please enter email id"+str(i+1)+": ")

                    email+=(eid,)

                    e=eid.split("@")

                    username=username+(e[0],)

                    domainname=domainname+(e[1],)

                print("The IDs in the tuple:",email)

                print("The username of email ids are: ",username)

                print("The domain name of email ids are: ",domainname)

                Watch Explainer Video Here

                

1st puc computer science lab programs


                23. Write a program to input names of n students and store them in a tuple. Also, input a name from the user and find if this student is present in the tuple or not.

23.	Write a program to input names of n students and store them in a tuple


                name=tuple()

                n=int(input("How many names do you want to enter?"))

                for i in range(n):

                    num=input("Enter the name"+str(i+1)+": ")

                    name=name+(num,)

                print("Names entered are:",name)

                search=input("Enter the name to be searched: ")

                if search in name:

                    print("Name",search,"is present")

                else:

                    print("Name",search,"is not present")

                Watch Explainer Video Here

                

1st puc computer science lab programs


                24. Write a program to create a dictionary from a string. Note: Track the count of the letters from the string. Sample string : ‘2nd pu course’. Expected output : {‘ ‘:2,’2’:1,’n’:1,’d’:1,’o’:1,’p’:1.’u’:2,’c’:1,’s’:1,’r’:1.’e’:1}

 

24.	Write a program to create a dictionary from a string

                s="2nd pu course"

                print("The input string is:",s)

                s1=dict()

                for character in s:

                    if character in s1:

                        s1[character]+=1

                    else:

                        s1[character]=1

                print("The dictionary created from characters of the string is:",s1)

            Watch Explainer Video Here

            

1st puc computer science lab programs








1st PUC COMPUTER SCIENCE LAB PROGRAMS PDF | class 11 computer science lab manual | 1st puc computer science programs 1st PUC COMPUTER SCIENCE LAB PROGRAMS PDF | class 11 computer science lab manual | 1st puc computer science programs Reviewed by Vision Academy on October 21, 2022 Rating: 5

No comments:

CheckOut

Powered by Blogger.