Python Fundamentals
Notes Part-1 ----- > PYTHON Notes Part-2 ------> Input and Output Statements Notes Part-3 ------> Conditional Statements Notes Part-4 -------> Operators in python Notes Part-5 ------> Datatypes in python Notes Part -6.1 ------> Lists Notes Part- 6.2 -----> Dictionary Reference Notes on For Loop and While Loop to read: 1. For Loop : A for loop is typically used when the number of iterations is known in advance. It is structured for cases where you need to iterate over a range , a sequence, or a collection (like a list or a string). Syntax: for i in range(start, stop, step): # Loop body Example with a for loop: n = int(input("enter number")) s = 0 for i in range(1, n+1): s = s + i print("sum =", s) This version iterates over a known range, starting from 1 to n . When n = 5 , the output will be: sum = 1 sum = 3 sum = 6 sum = 10 sum = 15 2. ...
Comments
Post a Comment