Practice for FizzBuzz (http://codingdojo.org/kata/FizzBuzz/)
- install pyenv and prepare the build-environments
- install python 3.12.2:
pyenv install 3.12.2
(export PYTHON_BUILD_MIRROR_URL_SKIP_CHECKSUM=1 && export PYTHON_BUILD_MIRROR_URL=https://mirrors.huaweicloud.com/python/
) - set pypi mirror:
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
- install uv:
pipx install uv
- activate the virtual environment:
source .venv/bin/activate
- sync the dependencies:
make sync-dep
exit the virtual environment: deactivate
Write a program that prints the numbers from 1 to 100. But there are three exceptions:
- For multiples of three, print "Fizz" instead of the number.
- For the multiples of five, print "Buzz" instead of the number.
- For numbers which are multiples of both three and five, print "FizzBuzz" instead of the number.
$ python fizzbuzz.py
1
2
Fizz
4
Buzz