[Tutor] FW: urgent help!! THANKS EVERYONE!

Prasad, Ramit ramit.prasad at jpmorgan.com
Fri Nov 18 16:26:32 CET 2011


Forwarding to the list since I wasn't the only person who helped ;)

Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423

--

From: ADRIAN KELLY [mailto:kellyadrian at hotmail.com] 
Sent: Thursday, November 17, 2011 6:08 PM
To: Prasad, Ramit
Subject: RE: [Tutor] urgent help!! THANKS EVERYONE!

Thanks for your help i just got it going my way below - but your way looks easier and better!  
thanks for all your help everyone.  feel free to comment on my method - its awkward but it works.......... 

adrian

def exchange(cash_in):
    euro=1
    dollar=1.35
    base=50
    if cash_in>base:
        totalreturn=cash_in*dollar
    else:
        totalreturn=0
    return totalreturn


def main():
    amount=0
    amount = float(raw_input('how much do you want to change:'))
    while amount<50:
        print 'enter an amount over 50'
        amount = float(raw_input('how much do you want to change:'))
    else:
        total=exchange(amount)
        print 'Your exchange comes to: ',total
  
    
main()

 
  
> From: ramit.prasad at jpmorgan.com
> To: kellyadrian at hotmail.com; waynejwerner at gmail.com
> CC: tutor at python.org
> Subject: RE: [Tutor] urgent help!!!!!!!!!!!
> Date: Thu, 17 Nov 2011 23:43:10 +0000
> 
> def exchange(cash_in):
>     euro=1
>     dollar=1.35
>     base=50
>     if cash_in>base:
>         totalreturn=cash_in*dollar
>     else:
>         totalreturn=0
>     return totalreturn
> 
> amount=0
> # this would be better placed inside the main function.
> def main():
>     while amount<50:
>         amount = raw_input(float('how much do you want to change:'))
> # This should be 
> # amount = float( raw_input('how much do you want to change:' ) )
>     if amount<50:
>         total=0
>         print 'enter an amount over 50: '
>     else:
>         total=exchange(amount)
>         print 'Your exchange comes to: ',total
> 
> 
> Ramit
> 
> 
> Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
> 712 Main Street | Houston, TX 77002
> work phone: 713 - 216 - 5423
> 
> -- 
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  


More information about the Tutor mailing list