# L-10.5 MCS 260 Wed 9 Jul 2014 : q11.py
"""
A trigonometric function like A*sin(k*2*pi*t) has amplitude A
and frequency k (number of cycles per time unit).
Write a Python function f to evaluate A*sin(k*2*pi*t) at t
(the first argument of f) where default values for A and k are both one.
If the last optional argument of f takes the value nopi,
then the function will return the value A*sin(k*t) instead.
"""
def fun(time, amp=1, freq=1, arg='pi'):
    "return amp*sin(freq*2*pi*time)"
    from math import pi, sin
    if arg == 'nopi':
        return amp*sin(freq*2*time)
    else:
        return amp*sin(freq*2*pi*time)

ARAW = raw_input('give the amplitude : ')
KRAW = raw_input('give the frequency : ')
TRAW = raw_input('give the time : ')
AMP = float(ARAW)
FRQ = float(KRAW)
TIM = float(TRAW)
VAL = fun(TIM, AMP, FRQ)
print 'the value :', VAL
VAL = fun(TIM, AMP, FRQ, 'nopi')
print 'with nopi :', VAL
