Skip to main content

Command Palette

Search for a command to run...

Basics of Python-9

Published
2 min read
Basics of Python-9
P

Hello, I'm Priya Chakraborty, a dedicated B.Tech student in Electrical Engineering at Siliguri Institute Of Technology. I'm an enthusiastic learner, constantly seeking to expand my skill set and knowledge base. With a solid foundation in programming languages such as C, R, Python, and MySQL, I'm poised to tackle complex technical challenges.

But my passions extend beyond the realm of engineering. I'm also an aspiring content writer, driven by a curiosity to communicate ideas, both technical and non-technical, in a way that captivates and educates.

My journey is defined by a relentless pursuit of self-improvement, coupled with strong communication skills. I believe in the power of continuous learning and the importance of sharing knowledge.

Day-9

Loops :

Loops are the controlled structure in the program. There are 2 types of loops in python programming.

  1. For loop

  2. While loop

  3. FOR LOOP :

For loop is used to iterate a sequence of data items.

let's solve a problem on for loop :

a. Write a python program to print 10 numbers using for loop

n=int(input("enter the number"))
for i in range (1,n+1):
    print(i)

output :

  1. WHILE LOOP :

While loop, here the loop will run until the given condition is satisfied.

let's solve a problem on the while loop :

a. Write a python program to print ("Hello world") 3 times using the while loop :

count = 0
while (count < 3):
    count = count + 1
    print("Hello World")

output :

These are the two types of loops in python programming.

Problems :

Write a program in Python to display the Factorial of a number.

Write a program in Python to reverse a word.

Write a Python program to reverse a number.

Write a program to print n natural numbers in descending order using a while loop.

Write a program to display the first 6 multiples of 6

Write a program that appends the type of elements from a list.

Write a program to find and separate even and odd numbers from a list.

Write a program to find only odd values from a dictionary.

In my next blog, You will get to know in brief about these loops.

Thank you !!

More from this blog

Priya's blog

46 posts

Python Developer@Codeclause Mentee @Trailhead Salesforce Content Executive @GDSC SIT'22-23 Google Women Techmakers Ambassador @Google WTM Coreteam @ GirlScript Kolkata