Python Programmingiiinguiigjk
Python Programmingiiinguiigjk
OUTPUT:
OUTPUT:
Q3:Wap to create a pyramid of character “*” and a reverse
pyramid.
OUTPUT:
Q4:Wap to accept a character and perform the following:
(a)print whether the character is a letter a numeric digit or a
special character.
(b) if the character is a letter, print whether the letter is
uppercase or lowercase.
(c) if the character is a numeric digit print its name in text.
OUTPUT:
OUTPUT:
Q7: Write a function that accepts two strings and returns the
indices of all the occurrences of the second string in the first
string as a list. if the second
string is not present in the first string then it return-1.
OUTPUT:
Q8: Wap to create a list of the cubes of only the even integers
appearing in the input list (may have element of other type
also) using the following:
(a) “for” loop
(b) list comprehension
OUTPUT:
Q9: Wap to read a file and
(A) print total no. of characters, words and lines in the
file.
(B) calculate the frequency of each character in the file.
use a variable of dictionary type to maintain the count.
(C) print the words in reverse order.
(D) copy even lines of the file to a file named ‘file1’ and
odd lines to another file named ‘file 2’.
File 1: python.txt
Program:
OUTPUT:
OUTPUT:
OUTPUT: