You are on page 1of 4

# 1-wap to print factorial of given no.

# s= int(input("enter the no. to find facotrial"))


# fact=1
# if s<0:
# print("factorial is not possible")
# elif s==0:
# print("factorial is 1")
# else:
# for i in range(1,s+1):
# fact=fact*i
# print(fact)

# 2-wap program to calculate the average of numbers in given list(error)

# n= int(input("enter the no. of element you wanted to insert"))


# a=[]
# avg=0
# for i in range(0,n):

# l1= int(input("enter the elements of list to find average"))


# a.append(l1)
# avg=sum(a)/n
# print("average of the elements are",avg)

#3-wap program to exchange two values of two numbers without using temporary
variable

# a= int(input("enter value of a"))


# b= int(input("enter value of b"))
# a,b=b,a
# print("value of a is now",a)
# print("value of b is now",b)

# 4-wap a program to read a number n and compute n+nn+nnn

# n= int(input("enter the value of n"))


# a=(n+(n*n)+(n*n*n))
# print(a)

#5-wap program to reverse a given no


# n=int(input("enter number"))
# rev=0
# while(n>0):
# dig=n%10
# rev=rev*10+dig
# n=n//10
# print(rev)

# for i in range(0,l):

# num= int(input("enter a no to reverse it"))


# for i in num:

# 6- wap to check whether a number is positive or negative


# a=int(input("enter a no. to check "))
# if(a<0):
# print("no is negative")
# else:
# print("no is positive")

# 7-wap program to take in the marks of 5 subjects and display the grade(not
completed)

# a=[]
# avg=0
# grade=0
# for i in range(0,5):
# l1= int(input("enter marks of subject"))
# a.append(l1)
# avg=sum(a)/5
# if avg>75:
# grade='a'
# elif avg>60:
# grade='b'
# elif avg>45:
# grade='c'
# else:
# grade='d'
# print(grade)

# 8-wap to print all the numbers in a range divisible by a given no

# a=int(input("enter the no"))


# for i in range(1,100):
# if i/a== 0:

# print(a[i])

# 9-wap program to read two numbers and print their quotient and reminder

# a= int(input("enter 1st number"))


# b= int(input("enter 2nd number"))
# if a==0 or b==0:
# print("quotient and reminder are not defined")
# elif a>b:
# print("quotient is ",a/b)
# print("reminder is ",a%b)
# else:
# print("quotient is ",b/a)
# print("reminder is ",b%a)

# 10-wap to accept three digits and print all possible combinations from the
digits(not completed)

# n1=int(input("enter 1st no"))


# n2=int(input("enter 2nd no"))
# n3=int(input("enter 3rd no"))
# d=[]
# d.append(n1)
# d.append(n2)
# d.append(n3)
# for i in range(0,3):
# for j in range(0,3):
# for k in range(0,3):
# if(i!=j&j!=k&k!=i):
# print(d[i],d[j],d[k])

# 11-wap to print odd numbers within a given range


# n= int(input("enter the last limit"))
# for i in range(1,n+1):
# if i%2==1:
# print(i)

# 12-wap program to find the sum of digits in a number


# a=(input("enter a no"))
# s=[]

# for i in s:
# s.append(a)

# s +=a[i]
# print(s)

# 13-wap program to find the smallest divisor of an integer


# n=int(input("enter an integer"))
# a=[]
# for i in range(2,n+1):
# if n%i==0:
# a.append(i)
# a.sort()
# print("smallest divisor is",a[0])

# 14-wap program to count the number of digits in a number


# num=(input("enter a no."))
# a=[]
# count=0
# for i in num:
# a.append(num)
# count +=1
# print(count)

# 15-wap program to check if a given string is a palindrome

# str=input("enter a string")
# if str==reverse():
# print("the given string is palindrome")
# else:
# print("the given string is not palindrome")

# 16-wap program to print all integers that aren't divisible by either 2 or 3 and
lie between 1 and 50
# a=[]
# for i in range(1,50):
# if i%2!=0 and i%3!=0:
# a.append(i)
# print(a)

# 17-python program to find whether a number is a power of two

# 18-python program to find union of two list


# l1=int(input("enter elements of list1 "))
# l2=int(input("enter elements of list2 "))
# l=[l1,l2]
# print(l)
# 19-python program to find intersection of two list

# 20-python program to read list of words and return the longest one
# l1=input("enter the list of words")
# l1=l1.split()
# l1.sort()
# print("longest word is",l1.

# 21-python program to find elements occurring odd no. of times in a list

# 22-python program to count the number of vowels in a string

# s= input("enter the string")


# vowels=0
# consonents=0
# for i in s:
# if (s[i]=='a' or s[i]=='e' or s[i]=='i' or s[i]=='o' or s[i]=='u'):
# count=count+1
# else:
# consonent =consonent+1
# print("no. of vowels in a string",count)

# 23-python program to take in a string and replace every blank space with hyphen

# s= input("enter a string")
# s1=[]
# for i in range(len(s)):
# if (s[i]==''):
# s1=s.replace('','-')
# print(s)
# print(s1)
# 24-python program to calculate the no. of uppercase letters and lowercase letters
in a string

# s= input("enter a string")
# u=0
# l=0
# for i in s:
# if(i.isupper()):
# u=u+1
# else:
# l=l+1
# print("no. of uppercase",u)
# print("no. of lowercase",l)
# 25-python program to count the occurance of each word in a given string sentence

# s=input("enter a string")
# s1=[]

You might also like