By using Python code answer the following parts:
A) Write a program to ask the user to input their name and then output the type and length of the input.
B) Write a program to output the last 11 letters of 'Introduction to Indiana'.
C) Write a program to output the 3rd to the 11th letters of 'Introduction to Indiana'.
D) Write a program to ask the user to input a float number and output the rounded value of it using related
function.
E) Write a function to calculate the square root of the provided parameter using the Newton-Raphson
method. Print the difference between the square of the calculated value and the result of request.
#1
name = input('Enter name: ')
print('Type of input:',type(name))
print('Length of input:',len(name))
#2
string = 'Introduction to Indiana'
print('Last 11 letters of',string,':',string[-11:])
#3
string = 'Introduction to Indiana'
print('3rd to 11th letters of',string,':',string[2:11])
#4
num = float(input('Enter a float number: '))
print('Rounded value of',num,':',round(num))
#5
def squareRoot_newton(num):
x=num/2
while abs(x*x-num)>.000001:#upto 5 decimal
place accuracy
x=x-(x*x-num)/(2*x)
print('Difference between square of calculated
value and the number: ',abs(x*x-num))
return x
Get Answers For Free
Most questions answered within 1 hours.