"break" & "continue" Statements in Python #10

  Рет қаралды 101,113

Programiz

Programiz

Күн бұрын

Пікірлер: 123
@programizstudios
@programizstudios 2 жыл бұрын
🔥Finding it Damn Hard to Understand Python? Learn to code-the right way-with interactive lessons, quizzes & challenges. Build a strong programming base; it's IMPORTANT! Try Programiz PRO for Free: bit.ly/interactive-py
@nikanayo
@nikanayo 2 жыл бұрын
for languages in ['Python', 'Java', 'Swift', 'C', 'C++']: if (languages == 'Swift'or languages == 'C++'): continue print(languages)
@Abeedalamkhan
@Abeedalamkhan 2 жыл бұрын
To be Honest i was very very scared of programming, i am watching your Videos since last week and now i am writing few lines of codes just because of you. Thank you so much Your are diong a good job
@kismet4904
@kismet4904 3 жыл бұрын
Loving this series, I have learned a lot in such a short amount of time :D keep it up!
@ppirsjsh505
@ppirsjsh505 2 жыл бұрын
languages=["phyton","java","swift","C","C++"] for character in languages: if character=="C++" or character=="swift": continue print(character)
@ramraj4047
@ramraj4047 2 жыл бұрын
languages=["python","java","swift","c","c++"] for i in range (len(languages)): if(i==2 or i==4): continue print(languages[i])
@irynahryma2605
@irynahryma2605 Жыл бұрын
I've been treing this code for several times, it doesn't skip the languages 2 and 4. I've tried other examples with "break" and "continue", and it worked. Am I doing something wrong?
@SampannaAryal
@SampannaAryal Жыл бұрын
@@irynahryma2605 a=["Python", "Java", "Swift", "C", "C++"] for i in a: if i.upper()=="SWIFT" or i.upper()=="C++": continue print(i)
@gj18p420
@gj18p420 3 жыл бұрын
for i in range(10): language = str(input("Enter a language: ")) if language == "Swift" or language == "c++": continue print(language)
@sunakshiranjan3308
@sunakshiranjan3308 2 жыл бұрын
just one word- Awesome! Your channel is a very big help to me. Thanks :)
@kartikeshwarhingole6007
@kartikeshwarhingole6007 3 жыл бұрын
thank you sir I was able to complete your home work.
@amine2010amine
@amine2010amine 3 жыл бұрын
The best Channel to learn python
@nickjankovic2210
@nickjankovic2210 3 жыл бұрын
Great tutori, very professional and easy to follow. The only problem I have is ....I do not know where to find this "link below" where I can check the solution to exercizes at the end of each tutorial.
@programizstudios
@programizstudios 3 жыл бұрын
Hi Nick, You can find solutions to the exercise tasks in this link: github.com/programiz/python-course/
@pachakutiq266
@pachakutiq266 3 жыл бұрын
languages = [ "Python" , "Java" , "Swift" , "C" , "C++"] for a in languages: if a == "Swift": continue if a == "C++": continue print(a)
@kishansindhi5181
@kishansindhi5181 3 жыл бұрын
Are bhai output nahi aa raha
@pachakutiq266
@pachakutiq266 3 жыл бұрын
@@kishansindhi5181 really? What's ur error? I'll see if I can help..
@basirsaboor2367
@basirsaboor2367 3 жыл бұрын
can you do it by input function. plz!
@basirsaboor2367
@basirsaboor2367 3 жыл бұрын
input the language by the user
@saureetchakrabarti3913
@saureetchakrabarti3913 4 жыл бұрын
languages = ["Python", "Java", "Swift", "C", "C++"] for language in languages: if language == "Swift" or language == "C++": continue print(language)
@shadanakhtar5095
@shadanakhtar5095 3 жыл бұрын
But bro have a doubt that should i watch your video or study from the website and i think video is best because my brother is learning from the website and it take a lot of times but in video you explain soo nicely and fast
@kevinlavoie2800
@kevinlavoie2800 3 жыл бұрын
languages = 'Python', 'Java', 'Swift', 'C', 'C++' for language in languages: if language == 'Swift': continue elif language == 'C++': continue print(language)
@cezartofan1791
@cezartofan1791 3 жыл бұрын
#lol, we think almost the same: languages=("Python","Java","Swift","C","C++") for language in languages: if language=="Swift" or language=="C++": continue print(language)
@prajilshrestha7995
@prajilshrestha7995 4 жыл бұрын
Thumbnail: Feeling cute, might teach python later :D
@RedBull.RedBull
@RedBull.RedBull 3 жыл бұрын
I don't understand your comment.. how you feel the cute? Teaching Python later to whom?
@rudrakshchatterjee
@rudrakshchatterjee 3 жыл бұрын
😂
@glennswhiffmontage9397
@glennswhiffmontage9397 3 жыл бұрын
@@RedBull.RedBull didn't understand the assignment.
@akshaymanta55
@akshaymanta55 2 жыл бұрын
🤣🤣🤣 nailed it!
@vaishalidixit4871
@vaishalidixit4871 Жыл бұрын
THANK YOU SIR HERE IS THE CODING TASK languages = ["PYTHON","JAVA","SWIFT","C","C++"] for i in languages: if i == "C++" or i == "SWIFT" : continue print (i)
@DigitalAcademyOnline
@DigitalAcademyOnline 3 жыл бұрын
Learning Python is something you would like to get in your skills, but you do not know where to start? This NEW channel will help you out leaning Python Programming from scratch - for complete Beginners, Intermediate and Advanced Levels
@Footballeditz900
@Footballeditz900 2 жыл бұрын
languages = ["Python","Java","Swift","C","C++"] for i in languages: if i == languages[2] or i == languages[4]: continue else: print(i)
@beksaylor
@beksaylor 2 жыл бұрын
Love your videos..and website...thanks so much for all that you and your team do...
@KulbirAhluwalia
@KulbirAhluwalia 4 жыл бұрын
Everything is perfect, just keep your head stable when you speak. Thank you.
@thelegendarysummersky3189
@thelegendarysummersky3189 9 ай бұрын
for languages in ['Python', 'Java', 'Swift', 'C', 'C++']: if (languages == 'Swift' or languages == 'C++'): continue print("Language is: ", languages)
@oogook8153
@oogook8153 2 жыл бұрын
Thanks for clearing my confusion, it was really helpful but take care of your head don't move it so much it might "Break" and you may not be able to "Continue" with such series.
@lakshanj.kumara7648
@lakshanj.kumara7648 Жыл бұрын
languages=("Python" , "java" , "Swift" ,"C","C++") for language in languages: if language=="Swift" or language=="C": continue print(language)
@victorycoconut
@victorycoconut 2 жыл бұрын
Wait! I'm using your Learn Python app and it is really helpful!
@3zez2025
@3zez2025 3 жыл бұрын
lang = ["python","java","swift","c","c++"] for x in lang: if (x == "java"): continue elif (x == "c++"): continue print(x)
@EmereEmmanuel
@EmereEmmanuel 17 күн бұрын
here we go!!! languages = ['python', 'java' 'swift', 'php', 'c', 'c++'] for i in languages: if i == 'swift' or i == 'c++': continue print(i)
@adammunawar2806
@adammunawar2806 4 жыл бұрын
thisset = {'python', 'java', 'c', 'swift', 'c++'} for x in thisset: print(x) if x == 'switf' 'c++': continue
@johnhaythorpe1063
@johnhaythorpe1063 Жыл бұрын
Hi, I am loving the course. But this lesson appears to be out of order when I use the playlist to access the programs, it is appearing before lesson 9, instead of after. I am taking notes and practicing every exercise you demonstrate and then I vary my code a bit to see that I understand what you have taught. Thank you for this great series
@ozguravan9714
@ozguravan9714 2 жыл бұрын
languages=["pyhton","java","c","c++","swift"] for tongue in languages: if tongue=="swift": continue elif tongue=="c++": continue else: print(tongue)
@kanika1
@kanika1 2 жыл бұрын
languages =["Python", "Java", "C", "Swift", "C++"] for character in languages: if character == "Swift" or character =="C++": break print(character) Or...... languages =["Python", "Java", "C", "Swift", "C++"] for character in languages: if character == "Swift" or character =="C++": continue print(character)
@pinkshoelace8388
@pinkshoelace8388 2 жыл бұрын
I do not recommend the first solution, it will work in this case because Swift and C++ are the last values in the list, but if one of them was the first item on the list then the loop would break and none of the languages would be printed.
@kanika1
@kanika1 2 жыл бұрын
@@pinkshoelace8388 yes i agree. I realised this when I progressed in python. Thanks for spotting :-)
@sandipansarkar9211
@sandipansarkar9211 3 жыл бұрын
nice explanation
@Aravindblaze95
@Aravindblaze95 Ай бұрын
languages = ["Python", "Java", "Swift", "C", "C++"] result =[] for language in languages: if language in ["Swift"]: continue if language in ["C++"]: break result.append(language) print(f"The Output is {result}")
@Aravindblaze95
@Aravindblaze95 Ай бұрын
The Output is ['Python', 'Java', 'C']
@gemrwx
@gemrwx 3 жыл бұрын
languages = ["Python", "Java", "Swift", "C", "C++"] for item in languages: if item == "Swift" or item == "C++": continue else: print(item)
@programizstudios
@programizstudios 3 жыл бұрын
The logic you are trying to use is correct> However, there is an error in the test condition. Change the test condition to: item == "Swift" or item == "C++"
@gemrwx
@gemrwx 3 жыл бұрын
@@programizstudios Thanks
@upulithaperera4847
@upulithaperera4847 3 жыл бұрын
@@programizstudios but isn't it the same thing sir?
@abdu47137
@abdu47137 3 жыл бұрын
I appreciate you man, thanks for these tutorials
@codestone4911
@codestone4911 4 жыл бұрын
Nice Tutorial
@man0cash
@man0cash Жыл бұрын
thank you for this video it was helpful :)
@NehaGupta-if7se
@NehaGupta-if7se 3 жыл бұрын
Thank u so much sir...
@beans4114
@beans4114 3 жыл бұрын
languages = [ “python” , “Java” , “swift” , “C” , “C++” ] for i in languages: if i == “C++”: continue elif i == “swift”: continue print(i)
@harshad9203
@harshad9203 2 жыл бұрын
languages = ['python', 'java', 'swift', 'C', 'C++'] for item in languages: if item == 'swift' or item == 'C++': continue print(item) -- Programming Task Answer --
@nandupagere5764
@nandupagere5764 2 жыл бұрын
language = ["Python", "Java", "Swift", "C", "C++"] for item in language: if item=="Swift" or item=="C++": continue print(item)
@hijushajahan5263
@hijushajahan5263 3 жыл бұрын
languages = ["Python", "Java", "Swift", "C", "C++"] for i in languages: if i == "Swift" or i == "C++": continue print(i)
@georgemorrison1814
@georgemorrison1814 2 жыл бұрын
I am new in programing . After several attempts, I found out the answer on the Github repository is wrong. Correct code should be list = ["Python", "Java", "Swift", "C", "C++"] for item in list: if item == "Swift" or item =="C++" continue print(item)
@georgemorrison1814
@georgemorrison1814 2 жыл бұрын
Sorry it is right, I realized my mistake
@limingyin5094
@limingyin5094 2 жыл бұрын
you forgot to put : at the end of the if item == "Swift" or item =="C++":
@joyceadhiambo9977
@joyceadhiambo9977 2 жыл бұрын
Dude you are an excellent teacher...am now enjoying coding languages=['python','java','swift','c','c++'] for language in languages: languages=['python','java','swift','c','c++'] if language==('swift'): continue if language==('c++'): break print(language)
@mdiftekhar6876
@mdiftekhar6876 3 жыл бұрын
languages=["python","java","swift","c","c++"] for i in languages: if i=="swift": continue if i=="c++": continue print(i) print("h")
@shaileshsingh1445
@shaileshsingh1445 3 жыл бұрын
Wow you are such a great mentor , really helping to build basics :) God Bless you :)
@avachavoshi574
@avachavoshi574 4 жыл бұрын
Thank you!
@Jayashreee624
@Jayashreee624 2 жыл бұрын
I have written the same code just changed the variable " item" into "digits" at 2:36 but I am getting
@riturajritweek681
@riturajritweek681 3 жыл бұрын
languages=["python","java","c","c++","swift"] exclude=["java","c"] for i in languages: if i in exclude: continue else: print(i)
@rajeshdubey1260
@rajeshdubey1260 2 жыл бұрын
#Can you create a program so that all items of the language are printed except swift and C++ # language=["Python","Java","Swift", "c","c++"] language=["Python","Java","Swift","C","C++"] for i in language: if i=="Swift": continue elif i=="C++": continue else: print(i)
@dymonn
@dymonn 2 жыл бұрын
lang = ["Python", "Java", "Swift", "C", "C++"] for item in lang: if item == "Swift" or item == "C++": continue print(item)
@muradali1231
@muradali1231 3 жыл бұрын
If I type- "if item == 3: break" after "print(item)" it gives Indentation error. Does anybody know why this happens.
@jodezod
@jodezod 2 жыл бұрын
If it says indentation error then you probably messed up somewhere on the indentations
@santoshkapse3359
@santoshkapse3359 3 жыл бұрын
languages = ["Python", "Java", "Swift", "C", "C++"] for langauge in languages: if language == "Swift" or language == "C++": continue print(langauge) output :- Traceback (most recent call last): NameError: name 'language' is not defined
@divyaahirkar9183
@divyaahirkar9183 3 жыл бұрын
languages = [ " python" , " java" , " swift", " c" , " c++"] for language in langyages : print ( language) if language =" swift" or language = " c++" break
@kamrulhassan1219
@kamrulhassan1219 2 жыл бұрын
why used float number here? if we use int number what will happened
@ines7257
@ines7257 3 жыл бұрын
thank u!
@GiulioVonKerman
@GiulioVonKerman 3 жыл бұрын
What means float(input())? Thanks!
@VikasChauhan-ue2th
@VikasChauhan-ue2th 3 жыл бұрын
Float means decimal numbers like 10.6, 9.0, 4.89, etc. If you try "int" instead of "float" it will only give you integer values like 10, 9, 4 and not the decimal values.
@SUMANKUMAR-nt2ur
@SUMANKUMAR-nt2ur 2 жыл бұрын
Sir when next video will post
@bharadwajs3475
@bharadwajs3475 3 жыл бұрын
Op sir. With your 1video I can understand easily. I think you are a South Indian🇮🇳👳. I hope you will continue posting more videos regarding python. ❤❤
@Anonymous-tt7yi
@Anonymous-tt7yi 3 жыл бұрын
Yup, I am pretty sure because his first software job was in Hyderabad, India.
@lastonline2614
@lastonline2614 3 жыл бұрын
he is from nepal bro...
@soumadeepdas7610
@soumadeepdas7610 2 жыл бұрын
where is the github link sir?
@losikanicholas5105
@losikanicholas5105 Жыл бұрын
Y r we using or during the comparison
@anukaran3438
@anukaran3438 Жыл бұрын
lang = ['python','java','swift','c','c++'] for i in lang: if (i==lang[2]) or (i==lang[4]) : continue else: print(i)
@pavelboldin7227
@pavelboldin7227 3 жыл бұрын
I forgot about OR, so my code is: languages = [ ] for language in languages: if language == 'swift': continue if language =='C++': break print(language)
@f.a5148
@f.a5148 8 ай бұрын
my like turned your video from 1.4k to 1.5k
@demetrepanjakidze3787
@demetrepanjakidze3787 2 жыл бұрын
languages = ["Python", "Java", "Swift", "C", "C++"] list=[] for _ in range(len(languages)): if languages[_] == "Python" or languages[_] == "Java" or languages[_] == "C": list.append(languages[_]) print(list)
@DoryRutayisire
@DoryRutayisire Жыл бұрын
why can't we just use an if statement instead of a while loop at 3:34?
@emrandafadar4445
@emrandafadar4445 2 жыл бұрын
I can't understand this one but how about this :- languages = ["python", "java"', " Swift", "C"', " C++"] Print(languages [0]) Print(languages [1]) Print(languages [3])
@Markjairus95
@Markjairus95 Жыл бұрын
languages=["python","java","swift","c","c++"] print(languages[0,1,3])
@debebebelaye1881
@debebebelaye1881 4 ай бұрын
my_list = ["python", "Java", "Swift", "C", "C++"] for i in my_list: if i == "Swift" or i == "C++": continue print(i, end=",")
@some0ne308
@some0ne308 Жыл бұрын
#Question_answer language = ["Python", "Java", "Swift", "C", "C++"] for p_language in language: if p_language == "Swift": continue if p_language == "C++": continue print(p_language)
@anandshankarm777
@anandshankarm777 3 жыл бұрын
languages = ["Python", "Java", "Swift", "C", "C++"] print(languages[0]) print(languages [1]) print (languages [3])
@ayonbiswas4186
@ayonbiswas4186 2 жыл бұрын
[print(i) for i in ["python", "java", "swift", "c++", "c"] if i!="swift" and i!="c++"]
@bhavishibansal2573
@bhavishibansal2573 3 жыл бұрын
lang=["Python","Java","Swift","C","C++"] lang.remove("Swift") lang.remove("C++") print(lang)
@voytox
@voytox 3 жыл бұрын
you should use loop and what is thought in this vid
@torsoto23
@torsoto23 2 жыл бұрын
languages = ["Python", "Java", "Swift", "C", "C++"] without break&continue: for i in languages: if i != "Swift" and i !="C++": print(i) with break&continue: for i in languages: if i == "Swift": continue if i == "C++": continue print(i)
@SahilShaikh-7
@SahilShaikh-7 Жыл бұрын
language = ['python','java','swift','c','c++'] new_language = [ ] for i in language: if i == "swift" or i == 'c++': continue else: new_language.append(i) new_language will be ['python', 'java', 'c']
@wnttknwmrthngs3360
@wnttknwmrthngs3360 3 жыл бұрын
Is this acceptable? lang = ["Python", "Java", "Swift", "C", "C++"] for i in lang: if i == lang[2]: continue if i == lang[4]: continue print(i)
@gabrielnino2892
@gabrielnino2892 3 жыл бұрын
No thank you! ❤
@prathmeshborse2898
@prathmeshborse2898 4 жыл бұрын
😇
@misterduck4527
@misterduck4527 2 жыл бұрын
you didn't turn your head enough
@ivanpaulmendoza4248
@ivanpaulmendoza4248 2 жыл бұрын
where the fuck did the for and in range come from there is no tutorial for that in this series
@banerjeekrishna5230
@banerjeekrishna5230 4 жыл бұрын
Thalakai oopadam aaparaa babu
@anonymousboss824
@anonymousboss824 4 жыл бұрын
Binod
@freeprivatetutor
@freeprivatetutor 2 жыл бұрын
Why Break and continue are giving no output? Just blank, not any warning, Write exactly same but no output, only the end has printed
@moustafamedhat4189
@moustafamedhat4189 3 жыл бұрын
for languages in ['Python','Swift','C++','C','Java']: if languages =='Swift' or languages=='C++': continue print(languages)
@Mamata171
@Mamata171 3 жыл бұрын
tq
@keerthanasaini3167
@keerthanasaini3167 3 жыл бұрын
languages = ["Python", "Java", "Swift", "C", "C++"] for language in languages: if language == "Swift" or language == "C++": continue print(language)
@didio.1791
@didio.1791 2 жыл бұрын
languages = ['python','java','swift','c','c++'] for language in languages: if language == 'swift' or language == 'c++': continue print(language)
@majidalich2947
@majidalich2947 2 жыл бұрын
languages = ['Python', 'Java', 'C', 'Swift', 'C++'] for i in languages: if i == 'C++' or i == 'Swift': continue else: print(i)
@reqssss
@reqssss 10 ай бұрын
languages = ["Python", "Java", "Swift", "C", "C++"] for language in languages: if language == "Swift" and "C++": continue print(language)
@girishgh9793
@girishgh9793 Жыл бұрын
languages=["c++","c","phyton","swift","rust"] for language in languages: if language == "swift" or language == "c++": continue print(language)
@kevinekene3765
@kevinekene3765 2 жыл бұрын
languages = 'Python', 'Java', 'Swift', 'C', 'C++' for language in languages: if language == 'Swift' or language== 'C++': continue print(language)
@zainulabdeen7074
@zainulabdeen7074 2 жыл бұрын
languages = ["Python","Java","swift","C","C++"] for i in languages: if i=="swift" or i=="C++": continue print(i)
@Avinashsingh-lz3ey
@Avinashsingh-lz3ey 3 жыл бұрын
languages = ["Python", "Java", "Swift", "C", "C++"] for language in languages: if language == "Swift" or language == "C++": continue print(language)
@awesomeiram
@awesomeiram 3 жыл бұрын
but u just ripped-off that other comment tho
@sravankanagandla6147
@sravankanagandla6147 2 жыл бұрын
languages = ["Python", "Java", "Swift", "C", "C++"] for i in languages: if i=='Swift' or i=='C++': continue print(i)
For Loop in Python (So Easy to Understand) #9
9:03
Programiz
Рет қаралды 163 М.
Python if...else Conditionals (for Decision Making) # 7
11:28
Programiz
Рет қаралды 132 М.
Бенчик, пора купаться! 🛁 #бенчик #арти #симбочка
00:34
Симбочка Пимпочка
Рет қаралды 3,6 МЛН
How it feels when u walk through first class
00:52
Adam W
Рет қаралды 24 МЛН
Osman Kalyoncu Sonu Üzücü Saddest Videos Dream Engine 262 #shorts
00:20
10 Important Python Concepts In 20 Minutes
18:49
Indently
Рет қаралды 215 М.
break and continue Statements in Python
16:49
Neso Academy
Рет қаралды 12 М.
10 Python Comprehensions You SHOULD Be Using
21:35
Tech With Tim
Рет қаралды 152 М.
Python Functions (The Only Guide You'll Need) #12
17:20
Programiz
Рет қаралды 593 М.
What does '__init__.py' do in Python?
6:50
Indently
Рет қаралды 49 М.
While Loop in Python (Perform a Task 1000000 times With Ease) #8
10:12
Python Classes and Objects - OOP for Beginners
8:01
Python Simplified
Рет қаралды 560 М.
Nested while Loop in Python
12:49
Neso Academy
Рет қаралды 15 М.
Бенчик, пора купаться! 🛁 #бенчик #арти #симбочка
00:34
Симбочка Пимпочка
Рет қаралды 3,6 МЛН