Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Zip two vectors

Rust

#![allow(unused)]
fn main() {
for (a, b) in vec1.iter().zip(vec2) {
    println!("{a} {b}");
}
}

Python

for a, b in zip(vec1, vec2):
    print(f"{a} {b}")