Function
Function
Program Take the following Python code that stores a string: ‘str = 'Y-
3 tatata-acropolis: 0.8475'. Use find and string slicing to extract
the portion of the string after the colon character and then use
the float function to convert the extracted string into a floating
point number.
Solution print('Shreyas soni\n0827CS191224')
str="Y-tatata-acropolis: 0.8475"
pos=str.find(':')
num=str[pos+1:]
ans=float(num)
print(ans)
Program Write a function that returns the middle value among three
4 integers. (Hint: make use of min() and max()). Write code to
test this function with different inputs.
Solution print('Shreyas soni\n0827CS191224')
a=int(input("Enter 1st no:"))
b=int(input("Enter 2nd no:"))
c=int(input("Enter 3rd no:"))
def mid_num(num1,num2,num3):
max_num=max(num1, num2, num3)
min_num=min(num1, num2, num3)
return num1+num2+num3-max_num-min_num
print("middle no:",mid_num(a,b,c))