WAP ENTER ANY CHARATURE/NAME AND COUNT THE CHARATURE?#python_program
#WAP ENTER ANY CHARATURE/NAME AND COUNT THE CHARATURE?
'''
name=input( 'enter any name: ')
print('The total characture in{} is {}'.format(name,len(name)))
'''
#wap to check the values is even or odd numbr?
'''
x=eval(input('enter any number: '))
if x%2==0:
print('{} is a even number'.format(x))
else:
print('{} is odd number'.format(x))
print('thank you')
'''
#WAP TO CHECK WHETHER STUDENT PASSED IN EXAM OE NOT?
'''
marks=eval(input('enter your mark: '))
if marks >=35:
print('congratulations you passed the exam')
else:
print('you failed the exam betterluck next time')
'''
#wap to check wether the citizen is eligible for vote or not?
'''
Name=input('enter your name: ').lower()
if type(Name) is str:
age=eval(input('enter your age: '))
if age >=18:
print('Hello {} you are {} year old and you eligible for vote'.format(Name,age))
print('you can apply for voetr id card')
else:
print('Hello {} your age is {} and you are not eligible for vote'.foramt(Name,age))
print('you can apply after 18 year old')
print('Thank you')
'''
#WAP TO GENERATE THE NUMBER BETWEEN 5 TO 50(ALL 5 DIVISIBLE)?
'''
lst1=[]
for i in range(5,50):
if i%5==0:
lst1.append(i)
print(lst1)
'''
'''
for i in range(5,50,5):
print(i)
#output
5
10
15
20
25
30
35
40
45
'''
#wap to generate odd number between 11 to21?
'''
for i in range(11,21,2):
print(i)
#output
11
13
15
17
19
'''
#wap to generate the number between 10 to 1?
'''
for i in range(10,1,-1):
print(i)
#output
10
9
8
7
6
5
4
3
2
'''
#wap to generate the number between -10 to -1?
'''
for i in range(-10,-1,1):
print(i)
#output
=========
-10
-9
-8
-7
-6
-5
-4
-3
-2
'''
#wap to generate the number between -5 to -15?
'''
for i in range(-5,-15,-1):
print(i)
'''
# WAP to generate the number between -5 to 5;
'''
for i in range(-5,5,1):
print(i)
'''
#wap to generate the number between 5 to -5?
'''
for p in range(5,-5,-1):
print(p)
'''
#wap to generate all 3 divisibles between -21 to 21?
'''
for k in range(-21,21,3):
print(k)
'''
#wap to generate the number between -1 to 1 ?
'''
for k in range(-1,1,1):
print(k)
'''
#wap to generate the number between 0 to 1?
'''
for k in range(0,1,1):
print(k)
'''
#wap to generate the number between 0 to -1?
'''
for k in range(0,-1,-1):
print(k)
'''
#wap to generate the number between -1 to 0?
'''
for k in range(-1,0,1):
print(k)
#error
'''
#wap to generate the number between -5 to 7?
'''
for k in range(-5,7,1):
print(k)
'''
#wap to fetch all the even number from given list?
'''
Lst=[4,7,8,5,9] #4,8
for i in Lst:
if i%2==0:
print(i)
'''
#wap to fetch all 5 divisible number from given list?
'''
Lst=[10,13,20,24,30] #[10,20,30]
for x in Lst:
if x%5==0:
print(x)
'''
#wap to fetch all integer number from given list?
'''
Lst=[10,'a',1.5,15,True] #[10,15]
for x in Lst:
if type(x)==int:
print(x)
'''
#wap to fetch all vowel from given list?
'''
x=['a','e','i','o','u']
Lst=['a','r','d','o'] #['a','o']
for i in Lst:
if i in x:
print(i)
'''
#wap to fetch all the consonent from given string?
'''
st='python' #['p','y','t','h','o','n']
x=['a','e','i','o','u']
for i in st:
if i not in x:
print(i)
'''
#wap to fetch all words which contain 'a' characture?
'''
lst=['sai','nani','rohan','dhoni','kohli','django']
lst1=[]
for i in lst:
if 'a' in i:
lst1.append(i)
print(lst1)
'''
#wap to fetch all words which has even number of characture?
'''
lst=['sai','nani','rohan','dhoni','kohli','django']
lst1=[]
for i in lst:
if len(i)%2==0:
print(i)
print([i for i in lst if len(i)%2==0])
'''
#Wap to fetch all names which has two or more words?
'''
names=['python nani','Rohan','django anil','suresh']
for i in names:
'''
#wap to reverse all word in list?
'''
lst=['sai','nani','Rohan','dhoni']
lst1=[]
for i in lst:
lst1.append(i[::-1])
print(lst1)
print(lst1 for i in lst% lst1.append(i[::-1]))
'''
#15-wap to fetch all the words except first and last characture from each words?
'''
names=['python','Django','flask']
lst1=[]
for i in names:
if i[0] and i[-1]:
lst1.append(i)
print(lst1)
'''
#16-wap to count number of characture in the given string [without usinf length function]?
st='hyderabad tech hall'
x=0
for i in st:
x=x+1
print(x)
Comments
Post a Comment