python python tutorial in hindi python data type python variable python operators conditional statements in python python tuple

Python Set

Table of Contents All Chapters 1. Python Set 2. Iterate Set items 3. Set Methods ┬а ┬а ┬а3.1. Add items in Set ┬а ┬а ┬а3.2. Remove Set items ┬а ┬а ┬а2.3.┬а Join Sets ┬а Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Python String Python List Python Tuple Hamburger Toggle Menu Table of Contents 1. Python Set 2. Iterate Set items 3. Set Methods ┬а ┬а ┬а3.1. Add items in Set ┬а ┬а ┬а3.2. Remove Set items ┬а ┬а ┬а2.3.┬а Join Sets Python Set in Hindi What is Python Set in Hindi Set, elements рдХрд╛┬а unordered рдУрд░ unindexed collections рд╣реЛрддрд╛ рд╣реИ рдЗрд╕рдХреЗ elements unique рд╣реЛрддреЗ рд╣реИрдВ рдорддрд▓рдм рдХреЛрдИ рднреА elements repeat рдирд╣реАрдВ рд╣реЛ рд╕рдХрддрд╛ рдФрд░ set unordered рд╣реЛрддрд╛ рд╣реИ рдЗрд╕рд▓рд┐рдП set рдХреЗ elements рдХреЛ рд╣рдо directly indexing рд╕реЗ access рдирд╣реАрдВ рдХрд░ рд╕рдХрддреЗ, set рдХреЛ { }┬а рдХреЗ define рдХрд┐рдпрд╛ рдЬрд╛рддреЗ рд╣реИрдВ рдпрд╛ рдлрд┐рд░ рд╣рдо set banane рдХреЗ рд▓рд┐рдП set function рдХрд╛ рднреА use рдХрд░ рд╕рдХрддреЗ рд╣реИрдВред ЁЯРН tuple.py Copy to clipboard 1 2 3 4 5 6 7 8 9 10 my_set = {5, 7, 3, 1} print(my_set) # using set() method a = [4, 2, 7] my_set = set(a) print(my_set) # create empty set empty_set = set() How to Iterate Set Items in Hindi loop рдХрд╛ use рдХрд░рдХреЗ рд╣рдо set рдХреЗ elements рдХреЛ iterate рдХрд░ рд╕рдХрддреЗ рд╣реИ, рдзреНрдпрд╛рди рджреАрдЬрд┐рдП рд╣рдо indexing рд╕реЗ set рдХреЗ items рдХреЛ access рдирд╣реАрдВ рдХрд░ рд╕рдХрддреЗ рд╣реИред┬а ЁЯРН access.py Copy to clipboard 1 2 3 4 5 6 7 fruits = {"banana", "apple", "guava"} for i in fruits: print(i) # Output : banana # apple # guava Set Methods in Hindi python рдореЗ set рдХреЗ рд▓рд┐рдП build-in methods рд╣реЛрддреЗ рд╣реИ, рдЬрд┐рдирдХрд╛ use рдХрд░рдХреЗ set рдХреЗ рд╕рд╛рде рдЕрд▓рдЧ рдЕрд▓рдЧ operation perform рдХрд┐рдпрд╛ рдЬрд╛рддрд╛ рд╣реИред┬а Syntex: method рдХреЛ рдХрд┐рд╕реА рднреА variable рдХреЗ рд╕рд╛рде use рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП dot ( . ) рдХрд╛ use рдХрд░рддреЗ рд╣реИред Example: add() : рдЗрд╕ method рдХрд╛ use рд╣рдо set рдореЗ рдирдП item рдХреЛ add рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рдХрд░рддреЗ рд╣реИред┬а ЁЯРН add.py Copy to clipboard 1 2 3 4 5 6 my_fruits = {"apple", "banana"} my_fruits.add("cherry") print(f"Set after adding 'cherry': {my_fruits}") my_fruits.add("banana") # Adding a duplicate, set remains unchanged print(f"Set after trying to add 'banana' again: {my_fruits}") How to Remove set items in Hindi ЁЯРН join.py Copy to clipboard 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 # remove() my_colors = {"red", "green", "blue", "yellow"} my_colors.remove("green") print(f"Set after removing 'green': {my_colors}") # discard() my_numbers = {10, 20, 30, 40, 50} my_numbers.discard(30) print(f"Set after discarding 30: {my_numbers}") # pop() my_items = {"apple", "banana", "cherry"} popped_item = my_items.pop() print(f"Popped item: {popped_item}") print(f"Set after pop(): {my_items}") # clear() my_data = {10, 20, 30} my_data.clear() print(f"Set after clear(): {my_data}") How to Join Sets in Hindi ЁЯРН join.py Copy to clipboard 1 2 3 4 5 6 my_set = {1, 2, 3} other_set = {3, 4, 5} my_set.update(other_set) print(f"Set after update(): {my_set}") my_set.union(other_set) print(f"Set after union(): {my_set}") intersection(): Do sets ka intersection return karta hai. difference(): Do sets ka difference return karta hai. symmetric_difference(): Do sets ka symmetric difference return karta hai. issubset(): Check karta hai ki ek set dusre set ka subset hai ya nahi. issuperset(): Check karta hai ki ek set dusre set ka superset hai ya nahi. рдЙрдореНрдореАрдж рдХрд░рддреЗ рд╣реИ рдХрд┐ рдЖрдкрдХреЛ python set рдЕрдЪреНрдЫреЗ рд╕рдордЭ рдореЗ рдЖ рдЧрдпрд╛ рд╣реЛрдЧрд╛ ред рдЕрдкрдиреЗ learning рдХреЛ continue рд░рдЦрдиреЗ рдХреЗ рд▓рд┐рдП next button рдкрд░ click рдХрд░реЗ, Previous Next Add a comment… Cancel Reply Logged in as Python Programming Hub. Edit your profile. Log out? Required fields are marked * Message*

python python tutorial in hindi python data type python variable python operators conditional statements in python python tuple

Python Tuple

Table of Contents All Chapters 1. Python Tuple 2. Access Tuple Items 3. Update Tuple 4. Iterate Tuple Items 5. Join Tuples 6. Nested Tuple 7. Tuple Methods ┬а Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Python String Python List Python Tuple Hamburger Toggle Menu Table of Contents 1. Python Tuple 2. Access Tuple Items 3. Update Tuple 4. Iterate Tuple Items 5. Join Tuples 6. Nested Tuple 7. Tuple Methods Python Tuple in Hindi What is Tuple in Python in Hindi Python рдореЗрдВ┬а Tuple, data рдХрд╛ рдПрдХ ordered рдФрд░ immutable collection рд╣реЛрддрд╛ рд╣реИ рдЬреЛ Elements рдХреЛ round bracket рдХреЗ рдЕрдВрджрд░┬а comma separate рдХрд░рдХреЗ┬а Store рдХрд░рддрд╛ рд╣реИ, Tuple рдХрд╛ use рд╣рдо рддрдм рдХрд░рддреЗ рд╣реИрдВ рдЬрдм рд╣рдореЗрдВ data рдХреЛ┬а unchangeable form рдореЗ store рдХрд░рдирд╛ рд╣реЛрддрд╛ рд╣реИред ЁЯРН tuple.py Copy to clipboard 1 2 3 4 num_tuple = (4, 3, 8) print(num_tuple) # Output : (4, 3, 8) How to Access Tuple Items in Hindi indexing рдХрд╛ use рдХрд░рдХреЗ рд╣рдо tuple рдХреЗ elements рдХреЛ access рдХрд░ рд╕рдХрддреЗ рд╣реИрдВ, indexing 0 рд╕реЗ рд╢реБрд░реВ рд╣реЛрддреА рд╣реИ tuple рдореЗрдВ negative indexing рднреА possival рд╣реИ рдпрд╣ -1 рд╕реЗ рд╢реБрд░реВ рд╣реЛрддреА рд╣реИ рдЬреЛ рдХреА last value рдХреЛ represent рдХрд░рддрд╛ рд╣реИ ЁЯРН access.py Copy to clipboard 1 2 3 4 5 6 7 fruits = ("banana", "apple", "guava") print(fruits[0]) print(fruits[1]) print(fruits[-1]) # Output : banana apple guava How to Updates Tuple in Hindi Tuple immutable рд╣реЛрдиреЗ рдХреЗ рдХрд╛рд░рдг рд╣рдо рдЗрд╕реЗ direct update рддреЛ рдирд╣реАрдВ рдХрд░ рд╕рдХрддреЗ but рдЕрдЧрд░ tuple рдХреЗ рдЕрдВрджрд░ mutable elements рд╣реЛ рдЬреИрд╕реЗ list рддреЛ рдЙрди elements рдХреЛ modified рдХрд┐рдпрд╛ рдЬрд╛ рд╕рдХрддрд╛ рд╣реИ ЁЯРН update.py Copy to clipboard 1 2 3 4 5 num = (4, 6, [5, 2]) num[2][0] = 1 print(num) # Output : (4, 6, [1, 2]) How to Iterate Tuple Items in Hindi tuple рдХреЗ items рдХреЛ iterate рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рд╣рдо loop рдХрд╛ use рдХрд░рддреЗ рд╣реИрдВ ЁЯРН iterate.py Copy to clipboard 1 2 3 4 5 6 fruits = ("banana", "apple", "guava") for i in fruits: print(i) # Output : banana # apple # guava How to Join More Than One Tuples in hindi + operator рдХрд╛ use рдХрд░рдХреЗ рд╣рдо рджреЛ рдпрд╛ рджреЛ рд╕реЗ рдЬреНрдпрд╛рджрд╛ tuples рдХреЛ join рдХрд░ рд╕рдХрддреЗ рд╣реИ ЁЯРН join.py Copy to clipboard 1 2 3 4 5 num1 = (4, 3, 8) num2 = (2, 1, 5) print(num1 + num2) # Output : (4, 3, 8, 2, 1, 5) Nested Tuple in Hindi рдЬрдм рд╣рдо tuple рдХреЗ рдЕрдВрджрд░ рднреА tuple рдХрд╛ use рдХрд░рддреЗ рд╣реИрдВ рддреЛ рдЗрд╕реЗ nested tuple рдХрд╣рд╛ рдЬрд╛рддрд╛ рд╣реИ ЁЯРН nested.py Copy to clipboard 1 2 3 4 num1 = (4, 3, (2, 1, 5), 8) print(num1) # Output : (4, 3, (2, 1, 5), 8) Tuple Methods in Hindi python рдореЗ tuple рдХреЗ рд▓рд┐рдП рдХреБрдЫ рд╣реА build-in methods рд╣реЛрддреЗ рд╣реИ, рдХреНрдпреЛрдВрдХрд┐ tuple immutable рд╣реЛрддрд╛ рд╣реИред┬а Syntex: method рдХреЛ рдХрд┐рд╕реА рднреА variable рдХреЗ рд╕рд╛рде use рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП dot ( . ) рдХрд╛ use рдХрд░рддреЗ рд╣реИред Example: count() : рдЗрд╕ method рдХрд╛ use рдХрд░рдХреЗ рд╣рдо tuple рдХреЗ рдХрд┐рд╕реА element рдХреЛ рдХрд╛рдЙрдВрдЯ рдХрд░ рд╕рдХрддреЗ рд╣реИрдВред рдХрд┐ рд╡реЛ element, tuple рдореЗрдВ рдХрд┐рддрдиреА рдмрд╛рд░ рдЖрдпрд╛ рд╣реИ. ЁЯРН count.py Copy to clipboard 1 2 3 4 5 6 7 8 9 10 my_tuple = (1, 2, 3, 2, 4, 2, 5) count_of_2 = my_tuple.count(2) print(f"Count of 2: {count_of_2}") # Output: Count of 2: 3 count_of_6 = my_tuple.count(6) print(f"Count of 6: {count_of_6}") # Output: Count of 6: 0 another_tuple = ('apple', 'banana', 'apple', 'orange') count_apple = another_tuple.count('apple') print(f"Count of 'apple': {count_apple}") # Output: Count of 'apple': 2 рдпрд╣рд╛рдБ рдХреБрдЫ tuple рдХреЗ methods рджрд┐рдП рдЧрдП рд╣реИ рдЬрд┐рдиреНрд╣реЗ рдЖрдк рдЗрд╕реА рддрд░рд╣ рд╕реЗ tuple рдХреЗ рд╕рд╛рде use рдХрд░рдХреЗ рдЗрдирдХреЗ result рдХреЛ рджреЗрдЦ рд╕рдХрддреЗ рд╣реИред ┬а ЁЯРН tuple methods.py Copy to clipboard 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 my_tuple1 = (1, 2, 3, 4, 5) total_sum = sum(my_tuple) print(f"Sum of elements: {total_sum}") # Output: Sum of elements: 15 my_list = [1, 2, 3] new_tuple_from_list = tuple(my_list) print(f"Tuple from list: {new_tuple_from_list}") # Output: Tuple from list: (1, 2, 3) my_tuple2 = (10, 5, 20, 3) minimum_value = min(my_tuple) print(f"Minimum value: {minimum_value}") # Output: Minimum value: 3 my_tuple3 = (5, 2, 8, 1, 9) sorted_list = sorted(my_tuple) print(f"Original tuple: {my_tuple}") # Output: Original tuple: (5, 2, 8, 1, 9) print(f"Sorted list: {sorted_list}") # Output: Sorted list: [1, 2, 5, 8, 9] my_tuple4 = (1, 2, 3, 'hello') length = len(my_tuple) print(f"Length of the tuple: {length}") # Output: Length of the tuple: 4 рдЙрдореНрдореАрдж рдХрд░рддреЗ рд╣реИ рдХрд┐ рдЖрдкрдХреЛ python tuple рдЕрдЪреНрдЫреЗ рд╕рдордЭ рдореЗ рдЖ рдЧрдпрд╛ рд╣реЛрдЧрд╛ ред рдЕрдкрдиреЗ learning рдХреЛ continue рд░рдЦрдиреЗ рдХреЗ рд▓рд┐рдП next button рдкрд░ click рдХрд░реЗ, Previous Next Add a comment… Cancel Reply Logged in as Python Programming Hub. Edit your profile. Log out? Required fields are marked * Message*

python python tutorial in hindi python data type python variable python operators conditional statements in python python tuple

Python List

Table of Contents All Chapters 1. Python List 2. Nested List 3. Range List 4. List Indexing 5. list Methods ┬а Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Python String Python List Hamburger Toggle Menu Table of Contents 1. Python List 2. Nested List 3. Range List 4. List Indexing 5. list Methods Python List in Hindi What is Python List in hindi Python List in hindi : python рдореЗрдВ list рдмрдирд╛рдиреЗ рдХреЗ рд▓рд┐рдП рд╣рдо square bracket рдХрд╛ use рдХрд░рддреЗ рд╣реИрдВ, рдФрд░ рдЙрдирдХреЗ рдЕрдВрджрд░ values рдХреЛ comma рд╕реЗ┬а separate рдХрд░рдХреЗ Store рдХрд░рддреЗ рд╣реИрдВ. рдЬреИрд╕рд╛ рдХреА example рдореЗрдВ рджрд┐рдпрд╛ рдЧрдпрд╛ рд╣реИ ЁЯРН lists.py Copy to clipboard 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 number_list = [5, 48, 9, 789, 0, 45] string_list = ["mango", "banana", "apple"] mixed_list = ["apple", 56, True, 2.8] empty_list = [] print(number_list) print(string_list) print(mixed_list) print(empty_list) # output: # [5, 48, 9, 789, 0, 45] # ['mango', 'banana', 'apple'] # ['apple', 56, True, 2.8] # [] What is Nested List in python in hindi рдЕрдЧрд░ рд╣рдо list рдХреЗрдЕрдВрджрд░ list рдмрдирд╛рддреЗ рд╣реИрдВ рддреЛ рдЗрд╕реЗ nested list рдХрд╣рд╛ рдЬрд╛рдПрдЧрд╛. for Example ЁЯРН nested list.py Copy to clipboard 1 2 3 4 nested_list = [[5,8],[4,1],[2,8]] print(nested_list) # Output: # [[5,8],[4,1],[2,8]] what is range list in python in hindi python рдореЗ range() рдПрдХ method рд╣реЛрддрд╛ рд╣реИ, рдЬрд┐рд╕рдХреЗ help рд╕реЗ рд╣рдо python List рдХреЛ create рдХрд░ рд╕рдХрддреЗ рд╣реИред рдЬреЛ list range() method рдХреЗ help рд╕реЗ create рдХрд┐рдпрд╛ рдЬрд╛рддрд╛ рд╣реИ рдЙрдиреНрд╣реЗ range list рдХрд╣рд╛ рдЬрд╛рддрд╛ рд╣реИред ЁЯРН range list.py Copy to clipboard 1 2 3 4 num = list(range(1, 10)) print(num) # Output: # [1, 2, 3, 4, 5, 6, 7, 8, 9] what is list comprehension in python in hindi pythhon рдореЗ list comprehension рдПрдХ рддрд░реАрдХрд╛ рд╣реИ list create рдХрд░рдиреЗ рдХрд╛┬а ЁЯРН create a list.py Copy to clipboard 1 2 3 4 comprehension_list = [a**2 for a in range(1, 6)] print(comprehension_list) # Output: # [1, 4, 9, 16, 25] what is list indexing in python in hindi or how to access list items рдЕрдЧрд░ рд╣рдо python list рдореЗ рд╕реЗ рдХрд┐рд╕реА particular item рдХреЛ access рдХрд░рдирд╛ рдЪрд╛рд╣рддреЗ рд╣реИ рддреЛ indexing рдХрд╛ use рдХрд░рддреЗ рд╣реИред indexing positive рдФрд░ negative рджреЛрдиреЛрдВ рддрд░реАрдХреЗ рд╕реЗ рдХреА рдЬрд╛ рд╕рдХрддреА рд╣реИред positive indexing рдореЗ list рдХреЗ first item рдХреЛ access рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП “0” рдХрд╛ use рдХрд░рддреЗ рд╣реИ рдФрд░ negative indexing рдореЗ list рдХреЗ last item рдХреЛ access рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП “-1” рдХрд╛ use┬а рдХрд░рддреЗ рд╣реИред ЁЯРН list indexing.py Copy to clipboard 1 2 3 4 5 6 my_list = ["banana", "grapes", "apple"] print(my_list[0]) print(my_list[-1]) # Output: # banana # apple how to change list items in python in hindi python рдореЗ рд╣рдо list рдХреЗ items рдХреЛ direct assignment рдХреЗ through change рдХрд░ рд╕рдХрддреЗ рд╣реИред list рдХреЗ рдЬрд┐рд╕ рднреА item рдХреЛ change рдХрд░рдирд╛ рдЙрд╕реЗ indexing рдХреЗ through select рдХрд┐рдпрд╛ рдЬрд╛рддрд╛ рд╣реИред┬а ЁЯРН adding item.py Copy to clipboard 1 2 3 4 5 my_list = ["banana", "grapes", "apple"] my_list[1] = "orange" print(my_list) # Output: # ['banana', 'orange', 'apple'] how to iterate list items in python in hindi python рдореЗ рд╣рдо list рдХреЗ items рдХреЛ for loop рдХреЗ through iterate рдХрд░ рд╕рдХрддреЗ рд╣реИред┬а ЁЯРН iterate items.py Copy to clipboard 1 2 3 4 5 my_list = ["banana", "grapes", "apple"] for i in my_list: print(my_list) # Output: # ['banana', 'grapes', 'apple'] how to add lists in python in hindi python рдореЗ рд╣рдо “+” operator рдХрд╛ use рдХрд░рдХреЗ lists рдХреЛ рдЖрд╕рд╛рдиреА рд╕реЗ add┬а рдХрд░ рд╕рдХрддреЗ рд╣реИред ЁЯРН adding lists.py Copy to clipboard 1 2 3 4 5 list1 = ["banana", "grapes", "apple"] list2 = [1, 2, 3] print(list1 + list2) # Output: # ['banana', 'grapes', 'apple', 1, 2, 3] List Methods in Hindi python рдореЗ list рдХреЗ рд▓рд┐рдП рдХрдИ рд╕рд╛рд░реЗ build-in methods рд╣реЛрддреЗ рд╣реИ. Syntex: method рдХреЛ рдХрд┐рд╕реА рднреА variable рдХреЗ рд╕рд╛рде use рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП dot ( . ) рдХрд╛ use рдХрд░рддреЗ рд╣реИред Example: append() : рдЗрд╕ method рдХрд╛ use рдХрд░рдХреЗ рд╣рдо string рдХреЗ рд╕рднреА lower case letters рдХреЛ upper case рдореЗ рдХрд░ рд╕рдХрддреЗ рд╣реИред┬а ЁЯРН append.py Copy to clipboard 1 2 3 4 5 list1 = ["banana", "grapes", "apple"] list1.append("orange") print(list1) # Output: # ['banana', 'grapes', 'apple', 'orange'] рдпрд╣рд╛рдБ рдХреБрдЫ list рдХреЗ methods рджрд┐рдП рдЧрдП рд╣реИ рдЬрд┐рдиреНрд╣реЗ рдЖрдк рдЗрд╕реА рддрд░рд╣ рд╕реЗ list рдХреЗ рд╕рд╛рде use рдХрд░рдХреЗ рдЗрдирдХреЗ result рдХреЛ рджреЗрдЦ рд╕рдХрддреЗ рд╣реИред append(): рдирдП element рдХреЛ list рдХреЗ end рдореЗ add рдХрд░рддрд╛ рд╣реИред┬а insert(): рдирдП element рдХреЛ specified index рдкрд░ insert рдХрд░рддрд╛ рд╣реИред remove(): рдХрд┐рд╕реА Specified value рдХреЛ list рдореЗ рд╕реЗ remove рдХрд░рддрд╛ рд╣реИред pop(): рдХрд┐рд╕реА Specified index рдкрд░рд░ element рдХреЛ remove рдХрд░рддрд╛ рд╣реИред index(): рдХрд┐рд╕реА Specified value рдХрд╛ first occurrence рдХрд╛ index return рдХрд░рддрд╛ рд╣реИред┬а count(): рдХрд┐рд╕ Specified value рдХрд╛ occurrences count рдХрд░рддрд╛ рд╣реИред sort(): List рдХреЗ elements рдХреЛ sort рдХрд░рддрд╛ рд╣реИред reverse(): List рдХреЗ elements рдХреЛ reverse рдХрд░рддрд╛ рд╣реИред ЁЯРН list methods.py Copy to clipboard 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 # Ek empty list banate hain my_list = [] # 1. append() – End me elements add karte hain my_list.append(10) my_list.append(20) my_list.append(30) print("After append:", my_list) # [10, 20, 30] # 2. insert() – Specific index par element insert karte hain my_list.insert(1, 15) # Index 1 par 15 insert hoga print("After insert:", my_list) # [10, 15, 20, 30] # 3. remove() – Specific value ko remove karte hain my_list.remove(20) print("After remove:", my_list) # [10, 15, 30] # 4. pop() – Specific index se element remove aur return karte hain removed_element = my_list.pop(1) # Index 1 ka element hataenge print("Popped element:", removed_element) # 15 print("After pop:", my_list) # [10, 30] # 5. index() – Kisi value ka first index find karte hain index_of_30 = my_list.index(30) print("Index of 30:", index_of_30) # 1 # 6. count() – Kisi value ka count nikalte hain count_of_10 = my_list.count(10) print("Count of 10:", count_of_10) # 1 # 7. sort() – List ko

Scroll to Top