Hello World 🌍⚓
Python 🐍⚓
To create standard developers program "Hello World 🌍!" with Python 🐍 follow this steps:
- Create directory (where you want to store Python projects, for example
PyExamples), to creat it, use:cd ~ && mkdir PyExamples; - Move to created directory,
cd PyExamples/; - Run command
python3.11 -m venv .venv- (it will create virtualenv inside.venvdirectory); -
To active virtualenv, use:
Success
Inside terminal appears
(.venv)before your username, this means that your virtualenv activated successfully.For example:
(.venv) user@User:~/PyExamples$ -
Create
hello_world.pyinside directory; -
Set content of a file to:
-
Run this code with this command:
python -m hello_world. You'll see output inside terminal:Hello World!
Rust 🦀⚓
- Create directory (where you want to store Rust projects, for example
RsExamples), to creat it, use:cd ~ && mkdir RsExamples; - Move to created directory,
cd RsExamples/; - Initialize binary project with
cargo new <binary_name>, for examplecargo new hello_world - Mode to binary project
cd <binary_name>/, for examplecd hello_world/ - Cargo creates
srcdirectory withmain.rsfile (src/main.rs). -
Cargo by default create
main.rswith "Hello, world!" program, but you can change it a little: -
Run code with this command
cargo run. You'll se output inside terminal:Hello World!