Re: phyton

2019-09-10 Thread tim.gast--- via Python-list
Op dinsdag 10 september 2019 13:03:46 UTC+2 schreef [email protected]:
> Hi everybody,
> 
> For school i need to write the right code to get the following outcome.
> Can someone help me with this
> I can't find a solution to link the word high to 1.21.
> 
> 11 print(add_vat(101, 'high'))
> 12 print(add_vat(101, 'low'))
> 
> Outcome:
> 
> 122.21
> 110.09
> 
> Thanks!

I have tried to get it with the dictonary but it doesn't work
You are right that it is homework and i am trying to figure it out but i cant 
find anything on the internet that can help me.
What am i doing wrong.

my_dict('high':21,'low':5)

def add_vat(amount, vat_rate):
  berekening = amount * (1+vat_rate)
  return round(berekening,2)

print(add_vat(101, 'high'))
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: phyton

2019-09-10 Thread tim.gast--- via Python-list
Op dinsdag 10 september 2019 13:03:46 UTC+2 schreef [email protected]:
> Hi everybody,
> 
> For school i need to write the right code to get the following outcome.
> Can someone help me with this
> I can't find a solution to link the word high to 1.21.
> 
> 11 print(add_vat(101, 'high'))
> 12 print(add_vat(101, 'low'))
> 
> Outcome:
> 
> 122.21
> 110.09
> 
> Thanks!

my_dict('high':21,'low':5)

def add_vat(amount, vat_rate):
  berekening = amount * (1+vat_rate)
  return round(berekening,2)

print(add_vat(101, 'high'))

outcome:
  File "", line 3
def add_vat(amount, vat_rate({'high':21,'low':5})):
^
SyntaxError: invalid syntax
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: phyton

2019-09-10 Thread tim.gast--- via Python-list
Op dinsdag 10 september 2019 14:36:13 UTC+2 schreef Pankaj Jangid:
> [email protected] writes:
> 
> > For school i need to write the right code to get the following outcome.
> > Can someone help me with this
> > I can't find a solution to link the word high to 1.21.
> >
> > 11 print(add_vat(101, 'high'))
> > 12 print(add_vat(101, 'low'))
> >
> > Outcome:
> >
> > 122.21
> > 110.09
> >
> You can do something like this ;-)
> 
> 
> import math
> 
> def add_vat(a, b):
> return math.ceil(100*(a * 0.57 + sum([ord(c) for c in list(b)]) * 
> 0.15538))/100
> 
> print(add_vat(101, 'high'))
> print(add_vat(101, 'low'))
> 
> -- 
> Pankaj Jangid

Wow
No idea what you did there :O
Thanks but I think I need to use the dictionary
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: phyton

2019-09-10 Thread tim.gast--- via Python-list
Op dinsdag 10 september 2019 14:45:58 UTC+2 schreef inhahe:
> On Tue, Sep 10, 2019 at 8:41 AM Pankaj Jangid 
> wrote:
> 
> > [email protected] writes:
> >
> > > For school i need to write the right code to get the following outcome.
> > > Can someone help me with this
> > > I can't find a solution to link the word high to 1.21.
> > >
> > > 11 print(add_vat(101, 'high'))
> > > 12 print(add_vat(101, 'low'))
> > >
> > > Outcome:
> > >
> > > 122.21
> > > 110.09
> > >
> > You can do something like this ;-)
> >
> >
> > import math
> >
> > def add_vat(a, b):
> > return math.ceil(100*(a * 0.57 + sum([ord(c) for c in list(b)]) *
> > 0.15538))/100
> >
> > print(add_vat(101, 'high'))
> > print(add_vat(101, 'low'))
> >
> > --
> > Pankaj Jangid
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> 
> 
> BAD BAD BAD don't do Pankaj's suggestion, tim, it's DEVILSPEAK

oeii thanks...
What will happen when i copy it?
-- 
https://mail.python.org/mailman/listinfo/python-list


phyton

2019-09-10 Thread tim.gast--- via Python-list
Hi everybody,

For school i need to write the right code to get the following outcome.
Can someone help me with this
I can't find a solution to link the word high to 1.21.

11 print(add_vat(101, 'high'))
12 print(add_vat(101, 'low'))

Outcome:

122.21
110.09

Thanks!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: phyton

2019-09-10 Thread tim.gast--- via Python-list
Op dinsdag 10 september 2019 13:03:46 UTC+2 schreef [email protected]:
> Hi everybody,
> 
> For school i need to write the right code to get the following outcome.
> Can someone help me with this
> I can't find a solution to link the word high to 1.21.
> 
> 11 print(add_vat(101, 'high'))
> 12 print(add_vat(101, 'low'))
> 
> Outcome:
> 
> 122.21
> 110.09
> 
> Thanks!

Hi inhahe,

Yeah the 21 was just an example the calculation will come later.
First i need to figure this out...
Is this what you mean with adding a dictionary?
berekening = amount * (1+(vat_rate={'high':21, 'low':5})
-- 
https://mail.python.org/mailman/listinfo/python-list