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:

Follow Telusko on Twitter:

Follow on Facebook:

Telusko :

Navin Reddy :

Follow Navin Reddy on Instagram:

Subscribe to our other channel:

Navin Reddy :

Telusko Hindi :

Donation:

PayPal Id : navinreddy20

Patreon : navinreddy20

ashwith chandraDecember 6, 2020 at 11:02 ambro why you have put ==0 in 7:22

sandhya kooliDecember 6, 2020 at 11:02 ama=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 ')

Kirubhahar KannanDecember 6, 2020 at 11:02 amDiff 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

Arjun Krishna1821December 6, 2020 at 11:02 amI=1

While i<=100

If iรท3==0

Continue

Print i

I+=1

Output???

Shreya PanwarDecember 6, 2020 at 11:02 amsomeone please tell me the first candy code using for loop .

Kranti KapaleDecember 6, 2020 at 11:02 amwhy you didn't used i++ for increment of i instead of i=i+1

Rohan DongreDecember 6, 2020 at 11:02 am# 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")

Rohit KumarDecember 6, 2020 at 11:02 am9:28 if we write continue instead of pass its still working fine can someone explain me the difference

Praveen RagavanDecember 6, 2020 at 11:02 amU r great for teaching python

SoulmanDecember 6, 2020 at 11:02 amWhat to do if I only want to print odd numbers?

Mahesh EntertainmentDecember 6, 2020 at 11:02 amSir can you please say which letter you are using for mod in keyboard

akshayDecember 6, 2020 at 11:02 amSir if we want to multiply the numbers not divisible by three by10 what to do

TUSHAR KANTI DEBNATHDecember 6, 2020 at 11:02 amx= int(input("Enter your number"))

for i in range(2,x):

if x%i ==0:

print("Number not prime")

break

if x == i+1:

print("Prime number")

Darshan VDecember 6, 2020 at 11:02 amSir, are there any operators like break + continue + pass (i.e: all combined)

please, my sincere apologies it is just for my clarification

Manoj. JDecember 6, 2020 at 11:02 amI 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??

Jilliane YvannaDecember 6, 2020 at 11:02 amsaving my degree, thank youuu

Ligy AntonyDecember 6, 2020 at 11:02 amThe class is very interesting.

Noman GhaniDecember 6, 2020 at 11:02 amhey 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

Athira SreekeshDecember 6, 2020 at 11:02 amFibinocci:

x = [0,1]

for i in range(0,48):

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

x.append(n)

print(x)

Himanshu YadavDecember 6, 2020 at 11:02 amWhy we cannot use continue in the last question?? Printing even values??

Akarsha SudheerDecember 6, 2020 at 11:02 amTo 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")

Anayat UllahDecember 6, 2020 at 11:02 amSir I love your teaching methodology

Tarun pDecember 6, 2020 at 11:02 aminstead of pass, we can just use continue

Aditi DeyDecember 6, 2020 at 11:02 amSuppose we want our vending machine to keep asking "How many candies do you want?" until the stock is 0.

How can we do that…??

Joe LukasDecember 6, 2020 at 11:02 amWhat's the difference between 'pass' and 'continue'? In this case the last example would work with either

Swadheen SamalDecember 6, 2020 at 11:02 amHere 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

Navneet KaurDecember 6, 2020 at 11:02 amSir 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.

MANSI LAKHMANIDecember 6, 2020 at 11:02 amThankyouuuuuuuuu Sirrrrrrrrrrrrrrrrrr๐๐๐๐๐๐๐๐๐๐๐ป๐๐ป๐๐ป๐๐ป๐๐ป๐๐ป๐๐ป

Arpan RoyDecember 6, 2020 at 11:02 amSir does pass works like continue?

ELECTRONIC DANCE MUSICDecember 6, 2020 at 11:02 amCan we do Fibonacci sequence code using index number?

I[x] = i[x-1] + i [x-2]

Neethu J WilliamDecember 6, 2020 at 11:02 amPrime 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")

K.J.A. KARUNATHILAKADecember 6, 2020 at 11:02 amx = 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!!')

Artist Jaideep AttriDecember 6, 2020 at 11:02 amI got my cs teacher๐

รรชwtรธnDecember 6, 2020 at 11:02 amfor i in range(1,21) :

if i %3 and i %5 != 0

Print(i)

Without using continue. We can do like this.

Muhammad Emmmad SiddiquiDecember 6, 2020 at 11:02 amx=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")

prince rajDecember 6, 2020 at 11:02 amx=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

Pawan GhimireDecember 6, 2020 at 11:02 amHii human !!

arjun anandDecember 6, 2020 at 11:02 am9:10 u r doing java again ๐คฃ๐คฃ

Sriram Durai PandianDecember 6, 2020 at 11:02 am8: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

sai kiranDecember 6, 2020 at 11:02 amx=int(input('give a number'))

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

print('prime')

else:

print('not a prime')

sai kiranDecember 6, 2020 at 11:02 amimport 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=' ')

Om NikhargeDecember 6, 2020 at 11:02 amYou are a good teacher!๐