Iterating using For loop | Syntax

Publicado em: 04 Março 2019
no canal de: EdYoda
266
4

For more courses visit : https://www.edyoda.com/

In this video we will discuss how to write the for loop to iterate over a collection of element and perform certain operation on every element. We will also discuss the built in range() function to generate series of numbers.

Practice Problem:

1) Write a Python program that sums all of the first integers, the second integers, and the third integers, outputting the resulting sums all.

if the input is

[2, 5,7]

[3, 6, 10]

[1, 2, -3]

[2, 4, 1]

Then the output should be

[8, 17, 15]

2) v is a list containing numbers. Write Python code to find and print the highest two values in v. If the list contains only one number, print only that number. If the list is empty, print nothing. For example,

v = [ 7, 3, 1, 5, 10, 6 ]

Output l = [7,10]


Nesta página do site você pode assistir ao vídeo on-line Iterating using For loop | Syntax duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário EdYoda 04 Março 2019, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 266 vezes e gostou 4 espectadores. Boa visualização!