phyton
Piet van Oostrum
piet-l at vanoostrum.org
Tue Sep 10 07:46:12 EDT 2019
tim.gast at quicknet.nl writes:
> 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!
You could use a dictionary to connect the words to the values.
As this is homework you have to do it yourself. Learn about dictionaries. Otherwise just use 'if'.
--
Piet van Oostrum <piet-l at vanoostrum.org>
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
More information about the Python-list
mailing list