# #22 Python Tutorial for Beginners | Break Continue Pass in Python

///#22 Python Tutorial for Beginners | Break Continue Pass in Python
• ## #22 Python Tutorial for Beginners | Break Continue Pass in Python  Add to favorites

Python Tutorial to learn Python programming with examples
Complete Python Tutorial for Beginners Playlist :
Python Tutorial in Hindi :

Github :-

In this video we will see:
– Break keyword in Python
– Jumping out of the block or loop
– Continue keyword
– Pass in Python

Editing Monitors :

Check out our website:

Telusko :
Navin Reddy :

Subscribe to our other channel:
Navin Reddy :
Telusko Hindi :

Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20

source

By |2020-12-06T11:02:51+00:00December 6th, 2020|Python Video Tutorials|42 Comments

1. ashwith chandra December 6, 2020 at 11:02 am - Reply

bro why you have put ==0 in 7:22

2. sandhya kooli December 6, 2020 at 11:02 am - Reply

a=int(input('enter a value : '))

c=0

i=1

while i<=a:

if (a%i==0):

c=c+1

i=i+1

if(c>=3):

print(a,' is the prime number ')

else :

print(a, 'is not prime nuber ')

3. Kirubhahar Kannan December 6, 2020 at 11:02 am - Reply

Diff b/w Continue and Pass:
Continue skip the loop , will not executes the below statements and goes to top of loop, where pass executes the remaining logic. Example below.

Continue :

for i in range(11):

if (i%2==0):

continue

print( i , " is odd")

—————————————-

1 is odd

3 is odd

5 is odd

7 is odd

9 is odd

Pass :

for i in range(11):

if (i%2==0):

pass

print( i , " is an number")

———————————————

0 is an number

1 is an number

2 is an number

3 is an number

4 is an number

5 is an number

6 is an number

7 is an number

8 is an number

9 is an number

10 is an number

4. Arjun Krishna1821 December 6, 2020 at 11:02 am - Reply

I=1
While i<=100
If i÷3==0
Continue
Print i
I+=1
Output???

5. Shreya Panwar December 6, 2020 at 11:02 am - Reply

someone please tell me the first candy code using for loop .

6. Kranti Kapale December 6, 2020 at 11:02 am - Reply

why you didn't used i++ for increment of i instead of i=i+1

7. Rohan Dongre December 6, 2020 at 11:02 am - Reply

# check prime number

num = int(input("Enter positive number: "))
if num > 1:
# check for factors
for i in range(2, num//2):
if (num % i) == 0:
print(num, "is not a prime number")
print(i, "times", num//i, "is", num)
break
else:
print(num, "is prime number")

# if number input is less than or equal to 1, it is not prime
else:
print(num, "is not a prime number")

8. Rohit Kumar December 6, 2020 at 11:02 am - Reply

9:28 if we write continue instead of pass its still working fine can someone explain me the difference

9. Praveen Ragavan December 6, 2020 at 11:02 am - Reply

U r great for teaching python

10. Soulman December 6, 2020 at 11:02 am - Reply

What to do if I only want to print odd numbers?

11. Mahesh Entertainment December 6, 2020 at 11:02 am - Reply

Sir can you please say which letter you are using for mod in keyboard

12. akshay December 6, 2020 at 11:02 am - Reply

Sir if we want to multiply the numbers not divisible by three by10 what to do

13. TUSHAR KANTI DEBNATH December 6, 2020 at 11:02 am - Reply

for i in range(2,x):

if x%i ==0:

print("Number not prime")

break

if x == i+1:

print("Prime number")

14. Darshan V December 6, 2020 at 11:02 am - Reply

Sir, are there any operators like break + continue + pass (i.e: all combined)
please, my sincere apologies it is just for my clarification

15. Manoj. J December 6, 2020 at 11:02 am - Reply

I have doubt in 'pass' statement..
Plz explain clearly
WHY weare using ELSE condition in there…if we not use that what error will come there??

16. Jilliane Yvanna December 6, 2020 at 11:02 am - Reply

saving my degree, thank youuu

17. Ligy Antony December 6, 2020 at 11:02 am - Reply

The class is very interesting.

18. Noman Ghani December 6, 2020 at 11:02 am - Reply

hey dear when you take the range of i and when number 4 comes so it will be divided by 2 and equal to 2 and for 6/2 it would be 3 so when you put the condition for i%2!=0 so every odd and even number is not equal to zero
pls explain thanks

19. Athira Sreekesh December 6, 2020 at 11:02 am - Reply

Fibinocci:

x = [0,1]

for i in range(0,48):

n = x[i]+x[i+1]

x.append(n)

print(x)

20. Why we cannot use continue in the last question?? Printing even values??

21. Akarsha Sudheer December 6, 2020 at 11:02 am - Reply

To check if a given number is prime or not:

i=2

p = int(input("Enter a number:"))

while i<p:

if (p%i!=0):

pass

else:

print(p,"is not a Prime number")

break

i+=1

if (i==p):

print(p,"is a Prime number")

22. Anayat Ullah December 6, 2020 at 11:02 am - Reply

Sir I love your teaching methodology

23. Tarun p December 6, 2020 at 11:02 am - Reply

instead of pass, we can just use continue

24. Suppose we want our vending machine to keep asking "How many candies do you want?" until the stock is 0.
How can we do that…??

25. Joe Lukas December 6, 2020 at 11:02 am - Reply

What's the difference between 'pass' and 'continue'? In this case the last example would work with either

26. Here using this 'continue' to get all the numbers, without the numbers which are divisible by 3,5
We can also use this it
for i in range(1,101):
if i%3!=0 and i%5!=0:
print(i)
print("bye")
Sir can we do it without using continue

27. Navneet Kaur December 6, 2020 at 11:02 am - Reply

Sir after setting break point, I'm doing debugging (shift+f9) or run>debug 'navneet'.
But it's showing like>>
pydev debugger: process 3336 is connecting and again asking to put input,when I'm giving input again showing the same.
Please help me, this problem is occurring now only, earlier it used to debug as you were telling to do in the videos.

28. MANSI LAKHMANI December 6, 2020 at 11:02 am - Reply

Thankyouuuuuuuuu Sirrrrrrrrrrrrrrrrrr🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻

29. Arpan Roy December 6, 2020 at 11:02 am - Reply

Sir does pass works like continue?

30. ELECTRONIC DANCE MUSIC December 6, 2020 at 11:02 am - Reply

Can we do Fibonacci sequence code using index number?
I[x] = i[x-1] + i [x-2]

31. Neethu J William December 6, 2020 at 11:02 am - Reply

Prime number or not
n = int(input("Enter a number : "))

f = 0

i = 2

while i <= n/2 :

if n%i == 0 :

f = 1

break

i = i+1

if f==0 :

print("Prime")

else :

print("Not Prime")

32. K.J.A. KARUNATHILAKA December 6, 2020 at 11:02 am - Reply

x = 1

y = 2

z = 0

print(1,':not a prime number')

print(2,':prime number')

for i in range (48):

z = x + y

for j in range (2,z):

if z % j == 0:

print(z,':not a prime number')

break

else:

print(z,':prime number')

x = y

y = z

print('byeee!!')

33. Artist Jaideep Attri December 6, 2020 at 11:02 am - Reply

I got my cs teacher😇

34. Ñêwtøn December 6, 2020 at 11:02 am - Reply

for i in range(1,21) :
if i %3 and i %5 != 0
Print(i)

Without using continue. We can do like this.

35. x=int(input("enter a number"))

i=2

while i<x:

if x%i==0:

print("not a prime number")

break

i+=1

else:

print("prime number")

36. prince raj December 6, 2020 at 11:02 am - Reply

x=int(input('enter a number'))
i=2
while i<x:
if x%i==0:
print('not a prime number')
break
i+=1

else:
print('prime number')
i+=1

37. Pawan Ghimire December 6, 2020 at 11:02 am - Reply

Hii human !!

38. arjun anand December 6, 2020 at 11:02 am - Reply

9:10 u r doing java again 🤣🤣

39. Sriram Durai Pandian December 6, 2020 at 11:02 am - Reply

8:09
for i in range(1,101):
if i%3==0:
continue
elif i%5==0:
continue
print(i)
#To avoid printing numbers divisible by 3 and 5

40. sai kiran December 6, 2020 at 11:02 am - Reply

x=int(input('give a number'))

if (x%2!=0 and x%3!=0):

print('prime')

else:

print('not a prime')

41. sai kiran December 6, 2020 at 11:02 am - Reply

import math as m

p=[0,1]

for i in range(50):

y=int(m.fsum(p))

p.append(y)

for i in range(50):

print(p[i], end=' ')

42. Om Nikharge December 6, 2020 at 11:02 am - Reply

You are a good teacher!👍