Python Programing Lab EXERCISE - 3(c)

Aim: 
            Write a program using a for loop that loops over a sequence. What is sequence?

Description: 


A Sequence is the generic form for an ordered set. There are several types of sequences in Python. The following 3 are most important.
Lists: There are the most versatile sequence type. The elements of a list can be any object and lists are mutable.

Tuples: These are like lists, But Tuples are immutable.

Strings: These are a special type of sequence that can store only characters and having special notations.

Algorithm:

Output: Elements of sequence(List). 

Step1: Start 
Step2: Initialize the days=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']
Step3: Repeat Step4 until the last element in the list is reached 
Step4: Print ith element 
Step5: Stop

Program:


days=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']
print("Days of the week:")
for day in days:
      print(day)

Output:

Days of the week:
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday



No comments

File Uploading in PHP

  File Uploading in PHP PHP allow you to upload any type of a file i.e. image, binary or text files.etc..,PHP has one in built global variab...