#Program to find Average of 2 number (CWH)
input ( " Enter first number : " )
input ( " Enter second number : " )
a = int ( a ) #For Converting it to int from str type
b = int ( b ) # other wise bellow opertaion did not work as it is string
avg ( a + b ) / 2
print ( " The average of a and b is " , avg )
# Program to write a latter and then change its name and date using replace()
Application = '''Dear Name Sir
You are Selected in event of Date'''
Name=input("Input Name\t")
Date=input("Date\t")
Application = Application.replace("Name",Name)
Application = Application.replace("Date",Date)
print(Application)
Output:
Input Name Ani
Date 21
Dear Ani Sir
You are Selected in event of 21
# Program to find Double Space in a String
find()
string ="This is a string which contain double Space"
nods=string.find(" ")
print(nods)
# Program to find Double Space in a String
replace()
string ="This is a string which contain double Space"
nods=string.find(" ")
if (nods== -1):
print("No Double Space found")
else:
print("Double Space found at :", nods)
string=string.replace(" "," ")
print("\n")
print(string)