Saturday, June 29, 2019

iterating through the list

mynames = [ "Sam", "Pit", "Misch" ]
for n in mynames:
    print ("HELLO ", n)


output:

HELLO  Sam
HELLO  Pit
HELLO  Misch


Example 2:

from math import *
for i in range (0, 5):
    print(i,"\t", sqrt(i))


output:

No comments:

Post a Comment

python class topic video