Python Program To Check Prime Number
Python Program To Check Prime Number
#num = 407
if num == 1:
for i in range(2,num):
if (num % i) == 0:
print(i,"times",num//i,"is",num)
break
else:
# take input
num = int(input("Enter ASCII value: "))
# printing character
print("Character =", chr(num))
#c = 'g'
c=input("Enter a Character: ")
# print the ASCII value of assigned character in c
print("The ASCII value of '" + c + "' is", ord(c))
3. input a number and to print whether given character is an alphabet
# Python Program to check whether the given input is alphabet, number or special character
if((ch >= 'a' and ch <= 'z') or (ch >= 'A' and ch <= 'Z')):
print("The Given Character ", ch, "is an Alphabet")
elif(ch >= '0' and ch <= '9'):
print("The Given Character ", ch, "is a Digit")
else:
print("The Given Character ", ch, "is a Special Character")
4. pgm to search any word in given string /sentence
# Python3 implementation of the approach
for i in s:
# Driver code
s = "Geeks for Geeks"
word = "Geeks"
if (isWordPresent(s, word)):
print("Yes")
else:
print("No")
5. pgm that receives two numbers in a function and return the result of all arithematic operations
on these numbers.
6.