Categories:Viewed: 3 - Published at: a few seconds ago

Write a python program to print the divisors of a integer

num = int(input("Please enter a integer "))
mid = int(num / 2)
print("The divisiors of ",num," are :" )
for a in range(2,mid + 1):
    if num % a == 0:
        print(a, end = ' ')
else :
    print()
    print("-End-")

Write a python program to find the average of list of numbers provided as input by user

n=int(input("Enter the number of elements to be inserted: "))
a=[]
for i in range(0,n):
    elem=int(input("Enter element: "))
    a.append(elem)
avg=sum(a)/n
print("Average of elements in the list",round(avg,2))

Write a python program which takes an integer N as input and add the odd numbers up to N and print the result

N = int(input("Enter Number : "))
sum = 0
i = 1
while i <= N:
    sum = sum + i
    i = i + 2
print(sum)

Write a python function which takes input a string and returns whether is is a palindrome or not

def isPalindrome(s):
    return s == s[::-1]

Write a python program which takes list as an input and calculate mean of given list of numbers

lst = eval(input("Enter list : "))
mean = 0
sum = 0
for i in lst:
    sum  = sum + i
mean = sum / len(lst)
print(" The mean of given list is :", mean)

Write a python program which takes list as an input and calculate sum of given list of numbers

lst = eval(input("Enter list : "))
mean = 0
sum = 0
for i in lst:
    sum  = sum + i
print(" The mean of given list is :", sum)

Write a python program which takes list as an input and find frequency of all elements in list

lst = eval(input("Enter list : "))
mean = 0
sum = 0
for i in lst:
    sum  = sum + i
print(" The mean of given list is :", sum)

Write a python function that takes two lists as an input an print out common elements in two lists

def common_member(a, b): 
    a_set = set(a) 
    b_set = set(b) 

    if (a_set & b_set): 
        print(a_set & b_set) 
    else: 
        print("No common elements")  

Write a python function that takes two lists and append second list after the first list

lst1 = eval(input("Enter list : "))
lst2 = eval(input("Enter list : "))
print(lst1 + lst2)

Write a python program to calculate and print square root of numbers 0 to 100

i = 0
while i<= 100:
 print(i, "\t\t" , i**0.5)
 i = i + 1

Write a python program greets the user with "Hello", after user inputs his name:

name = input ("Input your name: ")
print("HELLO ", name)

Write a python program which takes input a string and print reverse string

name = input("Enter String")
print(name[::-1])