0% found this document useful (0 votes)
53 views24 pages

Practical Programs Solution KVCTC

Uploaded by

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

Practical Programs Solution KVCTC

Uploaded by

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

PRACTICAL-1

DATE:

AIM: Write a python program to Input


a welcome message and display it.
Software used: IDLE (Python 3.8)
Hardware used: Computer system.

CODE:

OUTPUT OF THE PROGRAM:


conclusion: I have understood how to use
print(),input() and “=” operator to display
message on screen.
PRACTICAL-2

AIM: Write a python program to input


two numbers and display the
larger/smaller number.
CODE:

OUTPUT OF THE PROGRAM:


CONCLUSION: : I have understood how to use
input() and if..else and str() and print()
PRACTICAL-3
AIM: Write a python program to input
three numbers and display the
largest/smallest number.
CODE:

OUTPUT OF THE PROGRAM:


CONCLUSION: : I have understood how to use of input()
and if..else and str() and print() and logical AND
operator.

PRACTICAL-4

AIM: Write a python program to input


two integers x and n, compute xn .
CODE:

OUTPUT OF THE PROGRAM:


CONCLUSION: : I have understood how to use of
input() print() and "**" and pow() function and
import statement
PRACTICAL-5

AIM: Write a python program to print


sum of
1 to 50
CODE:

Output of the Program:

CONCLUSION: : I have understood


how to use of for loop and range()
PRACTICAL-6

AIM: Write a python program to print


factorial of 1 to 10
CODE:

Output of the Program:

CONCLUSION: : I have understood


how to use of for loop and range()
PRACTICAL-7 a
AIM: Write a python program to input
the value of x and n and print the sum of
the following series:
i)1+x+x2+x3+x4+………xn
====================================================

====

1+x+x2+x3+x4+………xn
=============================
======
Code:

Output of the Program:


CONCLUSION: : I have understood how to
use for loop,range ()and if else
7b.AIM: Write a python program to
input the value of x and n and print
the sum of the following series:
=============================
ii) 1-x+x2-x3+x4-………xn
=============================
=
CODE:

Output of the program:


CONCLUSION: : I have understood how
to use for loop,range ()and if else
7c AIM: Write a python program to
input the value of x and n and print
the sum of the following series:
=========================
iii)x+x2/2-x3/3+x4/4+……xn/n
=========================
CODE:

Output of the program:


CONCLUSION: : I have understood how
to use for loop,range ()and if else
7d AIM: Write a python program to
input the value of x and n and print
the sum of the following series:
=============================
===
iv) x+x2/2! -x3/3! +x4/4! -……xn/n!
=============================
===
CODE:

Output of the program:


CONCLUSION: : I have understood
how to use for loop,range,factorial()
and if else
PRACTICAL-8
AIM: Write a python program
Generate following pattern
CODE:
CONCLUSION: : I have understood how to use
NESTED for loop,range AND CHR()
PRATICAL-9

AIM: Write Python program to


determine whether a number is a
perfect square or not.
If you find the square root of a number and it's a whole integer, that tells you that the
number is a perfect square. For instance, the square root of 25 is 5. The square root of 26
is not a whole integer. So, 26 is not a perfect square

CODE:

Output of the Program:


CONCLUSION: : I have understood how to find
digit perfect square no.
PRACTICAL 10
b) Python program to determine
whether a number is an Armstrong or
not.
(In case of an Armstrong number of 3 digits, the sum of cubes of each digit is equal to the
number itself. For example: 153 = 1*1*1 + 5*5*5 + 3*3*3 // 153 is an Armstrong
number.370,371,407 r Armstrong number.)

Logic to get single digit:

CODE:

Output of the program:


.
CONCLUSION: : I have understood how to find digit and armstrong no
PRACTICAL 11
c) Python program to determine
whether a number is palindrome or
not.
A 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 eg. 11
,121,25752 etc(rev=rev*10+digit)

CODE:

Output of the program:


CONCLUSION: : I have understood how to find digit and
reverse of number and palindrome no.

PRACTICAL-12
AIM: Write a python program to input a
number and check if the number is a prime or
a composite number.
(Prime no:A positive integer greater than 1 which has no other factors except 1 and
the number itself is called a prime number. 2, 3, 5, 7 etc. are prime numbers as they do
not.)

CODE:

Output of the program:


CONCLUSION: : I have understood how to write a python
program to input a number and check if the number is a
prime or a composite number.

PRACTICAL-13
AIM: Write a python program to print
Fibonacci series up to the entered n
positive number.
CODE:

Output of the program:

CONCLUSION: : I have understood how to


create fibonanci series.
PRACTICAL-11
AIM: Write a python program to compute
the greatest common divisor (GCD/HCF)
and least common multiple (LCM)of two
integers.
CODE:

Output
PRACTICAL-12
DATE: 14.10.2020

AIM: Write a python program to count


and display the number of vowels,
consonants, uppercase, lowercase
characters in string.
Software Used: IDLE (Python 3.8)
Hardware Used: Computer system.

CODE:
Output of a program:

CONCLUSION: : I have understood


how to write a python program to
count and display the number of
vowels, consonants, upper case
characters, lower case characters in a
given string.
PRACTICAL-13
DATE: 15.10.2020

AIM: Write a python program to input


a string and determine whether it is
palindrome or not; convert the case
of characters in a string.
Software Used: IDLE (Python 3.8)
Hardware Used: Computer system.
CODE:

Output of the program:


CONCLUSION: : I have understood
how to make python program to
input a string and determine
whether it is a palindrome or not.

You might also like