1+ """ 
2+        This is a Calucator. 
3+ In the Calucator, there are Simple Calucator And Calculator Converter.In the simple  
4+ Calucator, you can calucate a simple value. And in the Calucator Converter you can  
5+ convert any of the following values: 
6+ """ 
7+ 
8+ # function for background image: 
9+ """ 
10+ from tkinter import * 
11+ 
12+ root = Tk() 
13+ root.title('Bg setting') 
14+ img = PhotoImage(file = "white_blank_wallpaper_background.png") 
15+ Label (root, image = img).pack() 
16+ mainloop() 
17+ """ 
18+ # exit 
19+ 
20+ real_poster  =  "CALUCATOR" 
21+ print (real_poster .center (45 )
22+     
23+                              )
24+ 
25+ choos1i  =  print (" \n 1.Simple Calucator \n 2.Calucator Converter" )
26+ choos1  =  input (" " )
27+             
28+ 
29+ if (choos1  ==  "1" ):
30+   main_poster1  =  " Simple Calucator" 
31+   print (main_poster1 .center (45 )
32+       
33+        )
34+   
35+ # Simple Calculator Program in python... 
36+ 
37+ # Functions: Addition, Subtraction, Multiplication, and Division... 
38+ 
39+ # Function for Addition: 
40+ 
41+   def  addition (n1 , n2 ):
42+     return  n1  +  n2 
43+ 
44+ # Function for Subtraction: 
45+ 
46+   def  subtraction (n1 , n2 ):
47+     return  n1  -  n2 
48+ 
49+ # Function for Multiplication: 
50+ 
51+   def  multiplication (n1 , n2 ):
52+     return  n1  *  n2 
53+ 
54+ # Function for Division: 
55+ 
56+   def  division (n1 , n2 ):
57+       return  n1  /  n2 
58+ 
59+ 
60+   print ("Select Operations" )
61+   print (
62+     "1. Addition\n " 
63+        "2. Subtraction\n " 
64+           "3. Multiplication\n " 
65+       "4. Division\n " )
66+ 
67+ # ...Giving the option to the user to choose the operation... 
68+ 
69+   operation  =  int (input ("Enter Choice Of Operation:- \n 1:" 
70+                         "\n 2:" 
71+                            "\n 3:" 
72+                      "\n 4:" )   
73+                  )
74+ 
75+ #Taking Input from the Users.... 
76+ 
77+   n1  =  float (input ("Enter the First Number: " )
78+             
79+             )
80+   
81+   n2  =  float (input ("Enter the Second Number: " )
82+             
83+                    )
84+   
85+ #.....Apply Conditional Statements: To make operation as-per-user choices..... 
86+ 
87+   if  operation  ==  1 :
88+      print  (n1 , "+" , n2 , "=" , addition (n1 , n2 )         
89+            )
90+     
91+   elif  operation  ==  2 :
92+      print  (n1 , "-" , n2 , "=" , subtraction (n1 , n2 )
93+                     ) 
94+     
95+   elif  operation  ==  3 :
96+      print  (n1 , "*" , n2 , "=" , multiplication (n1 , n2 )
97+            ) 
98+     
99+   elif  operation  ==  4 :
100+      print  (n1 , "/" , n2 , "=" , division (n1 , n2 )
101+            )
102+     
103+   else :
104+      print ("Invalid Input" )
105+ 
106+ # Simple Calculator function has been Exited: 
107+ 
108+ if (choos1  ==  "2" ):
109+   main_title_poster  =  " CALUCATOR CONVERTER" 
110+   print (main_title_poster .center (47 )
111+       
112+        )
113+   
114+ # This function below is unit_converter, in which the unit is converted which you say... 
115+ unit_converteri  =  print ("Choose A Unit Converter:-\n 1.Length \n " 
116+       "2.Temperature \n 3.Data \n " 
117+             "4.Time" )
118+ unit_converter  =  input (" " )
119+                     
120+ 
121+ #This function below is length_converter,in which the length is converted which you say. 
122+ 
123+ if (unit_converter  ==  "Length"  or  unit_converter  ==  "1" ):
124+   r2i  =  print ("What Do You Call Converting: \n 1.meter(m)  \n " 
125+              "2.kilometers(km) \n "  
126+         "3.centimere(cm)" )
127+   r2  =  input ("Enter The Value: \n " 
128+                     " NOTE: [AS IT IS WRITTEN, IT HAS TO IN WRITTEN THE SAME WAY ]  \n " 
129+                 "1/2/3:-" )
130+            
131+   r3i  =  print ("What Do You Call Converting To: \n 1.meter(m) \n 2.kilometer(km) \n " 
132+           "3.centimetre(cm)" )
133+   r3  =  input (" Enter The Value: \n " 
134+                     " NOTE: [AS IT IS WRITTEN, IT HAS TO IN WRITTEN THE SAME WAY ]  \n " 
135+                 "1/2/3"  )
136+             
137+ #....This is entering_number function in which is the number put in it which you say.... 
138+   
139+   entering_number  =  float (input ("Enter The Value: " )
140+        
141+          )
142+ 
143+ #.....Apply Conditional Statements: To make operation as-per-user choices..... 
144+ 
145+   # Function will starts when unit_converter = length 
146+   if  (r2  ==  "meter(m)"  and  r3  ==  "kilometer(km)"  ):
147+     print (entering_number  /  1000  , "km" )
148+   elif  (r2  ==  "meter(m)"  and  r3  ==  "centimetre(cm)"  ):
149+     print (entering_number  *  100  , "cm" )
150+ 
151+   if  (r2  ==  "meter(m)"  and  r3  ==  "meter(m)"  ):
152+     print (entering_number *  1  , "m" )
153+   elif (r2  ==  "kilometer(km)"  and  r3  ==  "meter(m)" ):
154+     print (entering_number  *  1000  , "m" )
155+   if (r2  ==  "kilometer(km)"  and  r3  ==  "centimetre(cm)" ):
156+     print (entering_number  *  100000  , "cm" )
157+   elif (r2  ==  "kilometer(km)"  and  r3  ==  "kilomete(km)" ):
158+     print (entering_number  *  1  , "km" )
159+   if (r2  ==  "centimetre(cm)"  and  r3  ==  "meter(m)" ):
160+     print (entering_number  /  100  , "m" )
161+   elif (r2  ==  "centimetre(cm)"  and  r3  ==  "kilometer(km)"  ):
162+     print (entering_number  /  100000  , "km" )
163+   if (r2  ==  "centimetre(cm)"  and  r3  ==  "centimetre(cm)" ):
164+        print (entering_number  *  1  , "cm" )
165+ 
166+ # Function will starts when unit_converter = Temperature  
167+ 
168+ if  (unit_converter  ==  "Temperature"  or  unit_converter  ==  "2" ):
169+   r2ei  =  print ("What Do You Call Converting:-  \n 1.Celsius(C) \n " 
170+               "2.Fahrenheit(F) \n 3.Kelvin(K)" )
171+   r2e  =  input (" Enter The Value: \n 1/2/3" )
172+            
173+   r3ei  =  print ("What Do You Call Converting To:- \n 1.Celsius(C) \n 2.Fahrenheit(F) \n " 
174+               "3.Kelvin(K)" )
175+   r3e  =  input ("  Enter The Value: \n 1/2/3 " )
176+            
177+   r4e  =  float (input ("Enter The Value:" )
178+           
179+            )
180+   
181+   if  (r2e  ==  "Celsius(C)"  and  r3e  ==  "Fahrenheit(F)" ):
182+     print (r4e  *  9 / 5  +  32  , "F" )
183+   elif  (r2e  ==  "Celsius(C)"  and  r3e  ==  "Kelvin(K)" ):
184+       print (r4e  +  273.15  , "K" )
185+   if  (r2e  ==  "Celsius(C)"  and  r3e  ==  "Celsius(C)" ):
186+     print (r4e  *  1  , "C" )
187+     
188+   elif (r2e  ==  "Fahrenheit(F)"  and  r3e  ==  "Celsius(C)" ):
189+     print ((r4e  -  32 ) *  5 / 9  , "C" )
190+   if (r2e  ==  "Fahrenheit(F)"  and  r3e  ==  "Kelvin(K)" ):
191+     print ((r4e  -  32 ) *  5 / 9  +  273.15  , "K" )
192+   elif (r2e  ==  "Fahrenheit(F)"  and  r3e  ==  "Fahrenheit(F)" ):
193+     print (r4e  *  1  , "F" )
194+ 
195+   if (r2e  ==  "Kelvin(K)"  and  r3e  ==  "Celsius(C)" ):
196+     print (r4e  -  273.15  , "C" )
197+   elif (r2e  ==  "Kelvi(K)"  and  r3e  ==  "Fahrenheit(F)" ):
198+     print (r4e  *  9 / 5  -  459.67  , "F" )
199+   if (r2e  ==  "Kelvin(K)"  and  r3e  ==  "Kelvin(K)" ):
200+     print (r4e  *  1  , "K" )
201+ 
202+ # Function will starts when unit_converter = Data... 
203+ 
204+ if  (unit_converter  ==  "Data"  or  unit_converter  ==  "3" ):
205+   
206+     d1i  =  print ("What Do You Call Converting:-\n 1.Bits(Bit)\n 2.Bytes(B)\n 3.Kilobytes(KB)" 
207+              "\n 4.Megabytes(MB)\n 5.Gigabytes(GB)\n 6.Terabytes(TB)\n " 
208+              "7.Petabytes(PB)" )
209+     d1  =  input ("  Enter The Value: \n 1/2/3/4/5/6/7" )
210+             
211+     d2i  =  print ("What Do You Call Converting To:- \n 1.Bits(Bit)\n 2.Bytes(B)\n " 
212+                "3.Kilobytes(KB)\n " 
213+                "4.Megabytes(MB)\n 5.Gigabytes(GB)\n 6.Terabytes(TB)\n " 
214+                "7.Petabytes(PB)" )
215+     d2  =  input ("  Enter The Value: \n 1/2/3/4/5/67 " )
216+               
217+     d3  =  float (input (" Enter The Value:" )
218+             )
219+   
220+     if  (d1  ==  "Bit"  and  d2  ==  "(B)" ):
221+       print (d3  /  8  , "B" )
222+     elif  (d1  ==  "Bit"  and  d2  ==  "KB" ):
223+       print (d3  /  8000  , "KB" )
224+     elif  (d1  ==  "Bit"  and  d2  ==  "MB" ):
225+       print (d3  /  8000000  , "MB" )
226+     elif  (d1  ==  "Bit"  and  d2  ==  "GB" ):
227+       print (d3  /  8000000000  , "GB" )
228+     elif  (d1  ==  "Bit"  and  d2  ==  "TB" ):
229+       print (d3  /  8000000000000  , "TB" )
230+     elif  (d1  ==  "Bit"  and  d2  ==  "PB" ):
231+       print (d3  /  8000000000000000  , "PB" )
232+   # Bit function has started! 
233+     if  (d1  ==  "B"  and  d2  ==  "Bit" ):
234+       print (d3  *  8  , "Bit" )
235+     elif  (d1  ==  "B"  and  d2  ==  "KB" ):
236+       print (d3  /  1000  , "KB" )
237+     elif (d1  ==  "B"  and  d2  ==  "MB" ):
238+       print (d3  /  1000000  , "MB" )
239+     elif  (d1  ==  "B"  and  d2  ==  "GB" ):
240+       print (d3  /  1000000000  , "GB" )
241+     elif  (d1  ==  "B"  and  d2  ==  "TB" ):
242+       print (d3  /  1000000000000  , "TB" )
243+     elif  (d1  ==  "B"  and  d2  ==  "PB" ):
244+       print (d3  /  1000000000000000  , "PB" )     
245+   # Kilobytes (KB) function has started! 
246+     if  (d1  ==  "KB"  and  d2  ==  "Bit" ):
247+       print (d3  *  8000  , "Bit" )
248+     elif (d1  ==  "KB"  and  d2  ==  "B" ):
249+       print (d3  *  1000  , "B" )
250+     elif (d1  ==  "KB"  and  d2  ==  "MB" ):
251+       print (d3  /  1000  , "MB" )
252+     elif (d1  ==  "KB"  and  d2  ==  "GB" ):
253+       print (d3  /  1000000  , "GB" )
254+     elif (d1  ==  "KB"  and  d2  ==  " TB" ):
255+       print (d3  /  1000000000  , "TB" )
256+     elif (d1  ==  "KB"  and  d2  ==  "PB" ):
257+      print (d3  /  1000000000000  , "PB" )
258+ # Megabytes (MB) function has started! 
259+     if  (d1  ==  "MB"  and  d2  ==  "Bit" ):
260+       print (d3  *  8000000  , "Bit" )
261+     elif (d1  ==  "MB"  and  d2  ==  "B" ):
262+       print (d3  *  1000000 , "B" )
263+     elif (d1  ==  "MB"  and  d2  ==  "KB" ):
264+       print (d3  *  1000  , "KB" )
265+     elif (d1  ==  "MB"  and  d2  ==  "GB" ):
266+       print (d3  /  1000  , "GB" )
267+     elif (d1  ==  "MB"  and  d2  ==  "TB" ):
268+       print (d3  /  1000000  , "TB" )
269+     elif (d1  ==  "MB"  and  d2  ==  "PB" ):
270+       print (d3  /  1000000000  , "PB" )
271+ # Gigabytes (GB) function has started! 
272+     if (d1  ==  "GB"  and  d2  ==  "Bit" ):
273+       print (d3  *  8000000000  , "Bit" )
274+     elif (d1  ==  "GB"  and  d2  ==  "B" ):
275+       print (d3  *  1000000000  , "B" )
276+     elif (d1  ==  "GB"  and  d2  ==  "KB" ):
277+       print (d3  *  1000000  , "KB" )
278+     elif (d1  ==  "GB"  and  d2  ==  "MB" ):
279+       print (d3  *  1000  , "MB" )
280+     elif (d1  ==  "GB"  and  d2  ==  "TB" ):
281+       print (d3  /  1000  ,"TB" )
282+     elif (d1  ==  "GB"  and  d2  ==  "PB" ):
283+       print (d3  /  1000000  , "PB" )
284+ # Terabytes (TB) function has started! 
285+     if (d1  ==  "TB"  and  d2  ==  "Bit" ):
286+       print (d3  *  8000000000000  , "Bit" )
287+     elif (d1  ==  "TB"  and  d2  ==  "B" ):
288+       print (d3  *  1000000000000  , "B" )
289+     elif (d1  ==  "TB"  and  d2  ==  "KB" ):
290+       print (d3  *  1000000000  , "KB" )
291+     elif (d1  ==  "TB"  and  d2  ==  "MB" ):
292+       print (d3  *  1000000  ,"MB" )
293+     elif (d1  ==  "TB"  and  d2  ==  "GB" ):
294+       print (d3  *  1000  , "GB" )
295+     elif (d1  ==  "TB"  and  d2  ==  "PB" ):
296+       print (d3  /  1000  , "PB" )
297+   # Petabytes (PB) function has started!! 
298+     if (d1  ==  "PB"  and  d2  ==  "Bit" ):
299+       print (d3  *  8000000000000000  , "Bit" )
300+     elif (d1  ==  "PB"  and  d2  ==  "B" ):
301+       print (d3  *  1000000000000000  , "B" )
302+     elif (d1  ==  "PB"  and  d2  ==  "KB" ):
303+       print (d3  *  1000000000000  , "KB" )
304+     elif (d1  ==  "PB"  and  d2  ==  "MB" ):
305+       print (d3  *  1000000000  , "MB" )
306+     elif (d1  ==  "PB"  and  d2  ==  "GB" ):
307+       print (d3  *  1000000  , "GB" )
308+     elif (d1  ==  "PB"  and  d2  ==  "TB" ):
309+       print (d3  *  1000  , "TB" )
310+       
311+     # In the following function BITS(bit)/BYTES(B)/KILOBYTES(KB)/MEGABYTES(MB)/GIGABYTES 
312+   #(GB)/PEGABYTES(PB) = 1 
313+   
314+     elif (d1  ==  "Bit"  and  d2  ==  "Bit"  or  d1  ==  "B"  and  d2  ==  "B"  or  d1  ==  "KB"  and  d2  ==  
315+                         "KB"  or  d1  ==  "MB"  and  d2  ==  "MB"  or  d1  ==  "GB"  and  d2  == "GB"  or 
316+                       d1  ==  "TB"  and  d2  ==  "TB"  or  d1  ==  "PB"  and  d2  ==  "PB" ):
317+       print (d3  *  1  )
318+ 
319+ # Function will starts when unit_converter = Time 
320+ 
321+ if (unit_converter  ==  "Time"  or  unit_converter  ==  "4" ):
322+   t1i  =  print (" What Do You Call Converting:- \n 1.Hours(H) \n 2.Minutes(M) \n "             
323+                  "3.Secounds(S)" )
324+   t1  =  input ("  Enter The Value: \n 1/2/3 " )
325+           
326+   t2i  =  print ( "What Do You Call Converting To:- \n 1.Hours(H) \n 2.Minutes(M) \n " 
327+                    "3.Secounds(S)" )
328+   t2  =  input ("  Enter The Value: \n 1/2/3" )
329+           
330+   t3  =  float (input ("Enter The Value:" )
331+             )
332+   if (t1  ==  "H"  and  t2  ==  "M" ):
333+     print (t3  *  60  , "M" )
334+   elif (t1  ==  "H"  and  t2  ==  "S" ):
335+     print (t3  *  3600  , "S" )
336+   elif (t1  ==  "M"  and  t2  ==  "H" ):
337+     print (t3  /  60  , "H" )
338+   elif (t1  ==  "M"  and  t2  ==  "S" ):
339+     print (t3  *  60  , "S" )
340+   elif (t1  ==  "S"  and  t2  ==  "H" ):
341+     print (t3  /  3600  , "H" )
342+   elif (t1  ==  "S"  and  t2  ==  "M" ):
343+     print (t3  /  60  , "M" )
344+     
345+   # In the following function H/M/S = 1 
346+   elif (t1  ==  "H"  and  t2  ==  "H"  or  t1  ==  "M"  and  t2  ==  "M"  or  
347+                            t1  ==  "S"  and  t2  ==  "S" ):
348+     print (t3  *  1 )
349+   else :
350+     print ("Invalid Input" )
0 commit comments