Open in TheBrain

Python tutorial for beginners

<p>Jan 22, 2013 12:16 AM &#160;not bucky.... &#160;this is Rustomac;

&#160;

celsius to farenheit and

if &#160;elif elif else &#160;&#160;(select among 10 conversion programs)

&#160;

def convert():

&#160;&#160;&#160;n = input('Convert 1 C2F or 2 F2C: ');

&#160;&#160;&#160;if n == 1: &#160;&#160;C2F()

&#160;&#160;&#160;elif n==2: &#160;F2C()

&#160;&#160;

&#160;

def C2F():

&#160;&#160;&#160;celsius = input('Enter degrees in Celsius: ');

&#160;&#160;&#160;fahrenheit = (9.0/5.0) * celsius + 32;

&#160;&#160;&#160;print celsius, 'Celsius=', fahrenheit, 'Fahrenheit';

&#160;

def F2C():

&#160;&#160;&#160;fahrenheit = input('Enter degrees in Fahrenheit: ');

&#160;&#160;&#160;celsius = (5.0/9.0)* (fahrenheit - 32);

&#160;&#160;&#160;print fahrenheit, 'Fahrenhiet =', celsius, 'Celsius';

&#160;

to run this... &#160;press F5... you will then save this module; &#160;

then enter convert() &#160;to start it in the subordinate window;</p>

Attachments