phyton

tim.gast at quicknet.nl tim.gast at quicknet.nl
Tue Sep 10 08:40:26 EDT 2019


Op dinsdag 10 september 2019 14:36:13 UTC+2 schreef Pankaj Jangid:
> tim.gast at quicknet.nl 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....



More information about the Python-list mailing list