Saturday 14 November 2020

Write a program to input the value of x and n and print the sum of the series: x + x^2/2! - x^3/3! + x^4/4! + ............ x^n/n!

 PROGRAM:












INPUT & OUTPUT:



Write a program to input the value of x and n and print the sum of the series: x + x^2/2 - x^3/3 + x^4/4 + ........... x^n/n

 PROGRAM:











                

 INPUT & OUTPUT:





















Determine whether a number is a perfect number, an armstrong number or a palindrome


 Perfect number, a positive integer that is equal to the sum of its proper divisors. The smallest perfect number is 6, which is the sum of 1, 2, and 3. Other perfect numbers are 28, 496, and 8,128.


Armstrong number:  A number is called Armstrong number if it is equal to the sum of the cubes of its own digits.  For example: 153 is an Armstrong number since 153 = 1*1*1 + 5*5*5 + 3*3*3 and 371 is an Armstrong number since 371=3*3*3+7*7*7+1*1*1.


palindromic number (also known as a numeral palindrome or a numeric palindrome) is a number (such as 16461) that remains the same when its digits are reversed.

Write a program to input the value of x and n and print the sum of the series: 1-x+x^2-x^3+x^4 + ......... x^n

 PROGRAM:












INPUT & OUTPUT:



.Write a program to input the value of x and n and print the sum of the series: 1+x+x^2+x^3+x^4+ ............x^n

 PROGRAM:










INPUT & OUTPUT:



Given two integers x and n, compute x^n.

 PROGRAM:











INPUT & OUTPUT:





Tuesday 10 November 2020

Wednesday 2 September 2020

11th CS Python Practical List Year: 2020-21

1.  Write a program to print the statement-“Getting Started with python”.  Date: 02/09/2020
      print("Getting Started with python”)

2.  Write a program to read the value of two numbers and find their sum.  click here Date:02/09/20


3. Input two numbers and display the larger / smaller number. click here  Date: 04/09/20

4. Input three numbers and display the largest / smallest number. click here  Date: 05/09/20

5. Given two integers x and n, compute x^n. click here   Date: 09/09/20

6.Write a program to input the value of x and n and print the sum of the
  series: 1+x+x^2+x^3+x^4+ ............x^n  click here  Date: 12/09/20

7. Write a program to input the value of x and n and print the sum of the
  series: 1-x+x^2-x^3+x^4 + ......... x^n  click here Date: 16/09/20

8. Write a program to input the value of x and n and print the sum of the
  series: x + x^2/2 - x^3/3 + x^4/4 + ........... x^n/n  click here    Date: 18/09/20
                                        

9. Write a program to input the value of x and n and print the sum of the
  series: x + x^2/2! - x^3/3! + x^4/4! + ............ x^n/n! click here   Date: 19/09/20
          

10. Determine whether a number is a perfect number, an armstrong number or a
palindrome. click here  Date: 23/09/20

11. Input a number and check if the number is a prime or composite number. click here   Date: 25/09/20

12. Display the terms of a Fibonacci series. click here  Date: 26/09/20

13. Compute the greatest common divisor and least common multiple of two
integers. click here  Date: 30/09/20

14. Count and display the number of vowels, consonants, uppercase, lowercase
characters in string. click here  Date: 03/10/20

15. Input a string and determine whether it is a palindrome or not; convert the
case of characters in a string. click here  Date: 07/10/20

16. Find the largest/smallest number in a list/tuple click here  Date: 09/10/20

17. Input a list of numbers and swap elements at the even location with the
elements at the odd location. click here Date: 10/10/20

18. Input a list/tuple of elements, search for a given element in the list/tuple. click here  Date: 14/10/20

19. Input a list of numbers and test if a number is equal to the sum of the cubes of
its digits. Find the smallest and largest such number from the given list of
numbers. click here  Date: 04/11/20

20. Create a dictionary with the roll number, name and marks of n students in a
class and display the names of students who have marks above 75. click here   Date: 15/12/2020




******************************************* END*************************************************



11th CS Python Practical List Year: 2019-20


3.  Write a program to read time in hours, time in minutes, time in seconds and print time in seconds click Here.

4.  Write a program to read marks obtained in five subjects and give the percentage of marks.

5.  Write a program to read the radius of a circle and print the area and circumference of the circle.

6. Write a algorithm and program to read the value of a variable of a quadratic equation and find the discriminant and give the root of the quadratic equation. Click Here

7. Write a algorithm and program to input number of week days (1-7) and translate to its equivalent name of the week. (1 to Monday, 2 to Tuesday……7 to Sunday): click Here

8.Write a algorithm and program to sort 3 numbers without using conditional and looping statements: Click Here

9. Write a program to find absolute value for integer, real and complex numbersClick Here
                                                   
10. Write a algorithm and program to read a number and print the number of digits and the sum of the digits. using function with while loop : Click Here 

11 Write a flow chart and program to calculate factorial of an integer using for loop with function. Click Here

12. Write Algorithm and Python program to print all the numbers divisible by 3 an
and 5 for a given number : click Here

13. Write a algorithm and program to calculate simple interest and compound interest for x number of persons using looping with user defined function: Click Here 

14. Write a algorithm and program to check whether a given number is palindrome or not using function with while loop.Click Here

    Write a flow chart and program to print Fibonacci series i.e.0 1 1 2 3 5 8…… using while loop with function Click Here

15. Write a algorithm and python function program to find minimum and maximum in a list using built in function min() and max() : click Here

16. Write a algorithm and python function program to find minimum and maximum in a list without using built in function min() and max() through looping : Click Here

17. Write a algorithm and python function program to find mean value in a list using function average(): Click Here

18. . Write a algorithm and python function program to find mean value in a list without using function average(): Click Here

19. Write a algorithm and python function program to search an a element in the  list(linear search).Click Here

20. Write a algorithm and python function program to search an a element in the  tuple(linear search): Click Here

21 Write a algorithm and python programming counting the frequency of elements in a list using a dictionary Click Here


22 Write a algorithm and python program accessing elements in a list(array) one by one if element even no. multiply by 10 and odd numbers divide by 5. Click Here

23 Write a algorithm and python program accesses the elements one by one from the list if it is prime number display it. Click Here

Sorting Algorithms

24. Write a algorithm and python program sorting the elements using Bubble sort method through function: Click Here

25. Write a algorithm and python program sorting the elements using Insertion sort method through function: Click Here

26. Write a algorithm and python program Counting the number of operation while sorting the elements through function(bubble sort and insertion sort): Click Here

String

27. Write a algorithm and python program for traversing string using for, range function and slice operator: Click Here

28. Write a algorithm and python program compare strings: Click Here

Introduction to Python Modules

29. Write a algorithm and python program to implementing math module( import math- sqrt, ceil, floor, pow,  fabs, sin, cos, tan ) Click Here

30. Write a algorithm and python program to implementing random module(import random- random, randint and randrange) :Click Here

31. Write a algorithm and python program to implementing statistics module(import statistics- mean, median and mode): Click Here

RDBMS and  SQL(with mysql)- single table onle

1. RDBMS Notes:Click Here
2. SQL Programming: Click Here


15.   Write a algorithm and program to calculate the area of rectangle, circle, triangle depending upon the user’s choice using if else if with with function Click here

16.   Write a flowchart and program check whether the number is prime or not using for loop with function. Click Here



16. Write a algorithm and program to find the sum of series s=1+x+x2+x3………….xn? using for loop with function: Click Here

17.   Write a flow chart and program using nested loops to produce the following designs using for loop with function. Click Here
A)
*
**
***
****
*****
18 Write a algorithm and program to find a given number is Angstrom or not using function.
 Click Here

19. Write a algorithm and program to find simple interest and compound interest using function. Click Here
                                       


        






SQL Programs: Click Here  ( 02 Programs)

 

Sunday 23 August 2020

Text File Menu driven Program 2

 PROGRAM:

  



OUTPUT:

  


  
















def writ_an_f():

    fin=open("D:\\book.txt","r")

    fout=open("D:\\story.txt","w")

    s=fin.readlines()

    for j in s:

        if 'a' in j:

            fout.write(j)

    fout.close()

    fin.close()


def cnt():

    f=open("D:\\test2.txt","r")

    cont=f.read()

    print(cnt)

    v=0

    cons=0

    l_c_l=0

    u_c_l=0

    for ch in cont:

        if (ch.islower()):

            l_c_l+=1

        elif(ch.isupper()):

            u_c_l+=1

        ch=ch.lower()

        if( ch in ['a','e','i','o','u']):

            v+=1

        elif (ch in ['b','c','d','f','g',

                     'h','j','k','l','m',

                     'n','p','q','r','s',

                     't','v','w','x','y','z']):

            cons+=1

    f.close()

    print("Vowels are: ",v)

    print("consonants are : ",cons)

    print("Lower case letters are : ",l_c_l)

    print("Upper case letters are : ",u_c_l)


#Main program

while True:


    print("\n\nText files Menu driven program:")

    

    print("1. Remove all the lines that contain" )

    print(" the character `a’ in a file and write it" )

    print(" to another file\n" )  


    print("2.Read a text file and display the" )

    print(" number of vowels/ consonants/ uppercase/" )

    print(" lowercase characters in the file\n" ) 


    print("3. Exit\n")

    ch=int(input("Enter your choice : "))

    if ch==1:

        writ_an_f()        

    elif ch==2:

        cnt()

    elif ch==3:

        break

    else:

        print( " invalid choice ")