## Blog Pages

### Temperature Conversion Table

def Fah():
F=int(input('Enter the temperature on Fahrenheit(F)'))
C=(F - 32) * 5/9
K=(F - 32) * 5/9 + 273.15
print("Fahrenheit Value :",F)
print("Celsius Value :",C)
print("Kelvin Value:",K)

def Cel():
C=int(input('Enter the temperature on Celsius(C)'))
F=(C * 9/5) + 32
K=C + 273.15
print("Fahrenheit Value :",F)
print("Celsius Value :",C)
print("Kelvin Value:",K)

def Kel():
K=int(input('Enter the temperature on Kelvin(K)'))
F=(K - 273.15) * 9/5 + 32
C=K - 273.15
print("Fahrenheit Value :",F)
print("Celsius Value :",C)
print("Kelvin Value:",K)
print("\n")
print('1.Fahrenheit to Celsius & Kelvin\n2.Celsius to Fahrenheit & Kelvin\n3.Kelvin to Fahrenheit & Celsius\n4.Exit')
n=int(input('Enter the choice:'))
if n==1:
Fah()
elif n==2:
Cel()
elif n==3:
Kel()
elif n==4:
exit()
else:
print('Invalid options')

### Newton Raphson Method

#  Newton Raphson Method
# The Newton-Raphson method (also known as Newton's method) is a way
# to quickly find a good approximation for the root of a real-valued function

xcube=int(input('Enter the values for Xcube: '))

xsquare=int(input('Enter the values for Xsquare: '))

x=int(input('Enter the values for X: '))

constant=int(input('Enter the values for Constant: '))

X0=int(input('Enter the values for inital vaule X0: '))
# It can be any value, but based on the incorrectness the root convergence
#  will delay. Here we can use trail and error method for input value.
X1= X0-((((xcube*X0*X0*X0)+(xsquare*X0*X0)+(x*X0)+constant)/((xcube*3*X0*X0)+(xsquare*2*X0)+x)))

print ("Root at first approximations:",X1)

X2= X1-((((xcube*X1*X1*X1)+(xsquare*X1*X1)+(x*X1)+constant)/((xcube*3*X1*X1)+(xsquare*2*X1)+x)))

print ("Root at second approximations:",X2)

X3= X2-((((xcube*X2*X2*X2)+(xsquare*X2*X2)+(x*X2)+constant)/((xcube*3*X2*X2)+(xsquare*2*X2)+x)))

print ("Root at thrid approximations:",X3)

X4= X3-((((xcube*X3*X3*X3)+(xsquare*X3*X3)+(x*X3)+constant)/((xcube*3*X3*X3)+(xsquare*2*X3)+x)))

print ("Root at fourth approximations:",X4)

X5= X4-((((xcube*X4*X4*X4)+(xsquare*X4*X4)+(x*X4)+constant)/((xcube*3*X4*X4)+(xsquare*2*X4)+x)))

print ("Root at fifth approximations:",X5)

### To read a coordinate point in a XY coordinate system and determine its Quadrant

x=int(input('Enter the values for X'))

y=int(input('Enter the values for Y'))

if x > 0 and y > 0:
print ('x, y point lies in the First quandrant')

elif x < 0 and y > 0:
print ('x, y point lies in the Second quandrant')

elif x < 0 and y < 0:
print ('x, y point lies in the Third quandrant')

elif x > 0 and y < 0:
print ('x, y point lies in the Fourth quandrant')

elif x == 0 and y == 0:
print ('x, y point lies at the origin')

f = open("1.txt")
#create a text file which consists of names of students in class
# Printing file all the names
print("File contnet as in text file:",f.read())
f = open("1.txt")
# Printing file one by one letters
print("\nFile contnet one by one word fromtext file:")
while next != "":
print(next)

### Multiplication of two Matrices

X = [[4,1,7],[2,1,8],[3 ,7,1]];
Y = [[6,8,1],[9,7,5],[2,3,1]];
result = [[0,0,0],[0,0,0],[0,0,0]];

for i in range(len(X)):
for j in range(len(Y)):
for k in range(len(Y)):
result[i][j] += X[i][k] * Y[k][j]

for r in result:
print(r)
{"ft_lang_label":"__label__en","ft_lang_prob":0.5646484,"math_prob":0.9992897,"size":5413,"snap":"2020-45-2020-50","text_gpt3_token_len":1823,"char_repetition_ratio":0.15048993,"word_repetition_ratio":0.779452,"special_character_ratio":0.38019583,"punctuation_ratio":0.13520198,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99983823,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-10-19T23:42:50Z\",\"WARC-Record-ID\":\"<urn:uuid:41d2b8b3-fe12-4b70-b9dd-76b810d9ba19>\",\"Content-Length\":\"84227\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:9b81b4b8-7ed7-475a-9a11-0bd8af845dde>\",\"WARC-Concurrent-To\":\"<urn:uuid:fd77df86-eb08-4ba0-b42f-8e89e45d942b>\",\"WARC-IP-Address\":\"172.217.15.115\",\"WARC-Target-URI\":\"http://www.pythonforengineers.in/2018/04/\",\"WARC-Payload-Digest\":\"sha1:CUKEF6XKT5HV4TOSKWVZI37SILZGAHDE\",\"WARC-Block-Digest\":\"sha1:CALBSU4LSLNZBFPKXAB6HNTROGA2DOQ5\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-45/CC-MAIN-2020-45_segments_1603107867463.6_warc_CC-MAIN-20201019232613-20201020022613-00652.warc.gz\"}"}