Skip to content
Advertisement

Python For Vector

JavaScript

I want to achieve this result

The number entered was 1 Its predecessor is 0

The number entered was 2 His successor is 3

The number entered was 3 Its predecessor is 2

but I can’t store the numbers in the vector Please, help.

Advertisement

Answer

This code simply achieved the desired output. The mistake is the first loop which can be a hurdle, basically you don’t need another loop with same length. Simply remove this loop.

JavaScript

and copy input vet1 = int(input(f"number {i}: "))line and paste in an other loop

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement