diff --git a/List : Sum of List Items.md b/List : Sum of List Items.md index 34c38b13..d5eae10a 100644 --- a/List : Sum of List Items.md +++ b/List : Sum of List Items.md @@ -10,8 +10,15 @@ To write a Python program that calculates the **sum of all elements** in a list. ## 🧾 Program -Add code here +``` +L=[153,147,124,102] +print(sum(L))) +``` ## Output +image + + ## Result +Thus, the program has been successfully executed. diff --git a/Regex: Filter Words Without the Letter 'e'.md b/Regex: Filter Words Without the Letter 'e'.md index a9de1ce8..01e75795 100644 --- a/Regex: Filter Words Without the Letter 'e'.md +++ b/Regex: Filter Words Without the Letter 'e'.md @@ -14,7 +14,20 @@ To write a Python program that filters out and returns all elements from a list 5. Print the final filtered list. ## 🧾 Program -Add code here +~~~ +import re +l1=[] +items=['goal', 'new', 'user', 'sit', 'eat', 'dinner'] +for i in items: + if not re.search(r"e",i): + l1.append(i) +print(l1) +~~~ ## Output +image + + ## Result + +Thus, the program has been successfully executed. diff --git a/Strings-Accept a string and remove the nth index value from the string.md b/Strings-Accept a string and remove the nth index value from the string.md index 4b9e4c76..f7ac2afb 100644 --- a/Strings-Accept a string and remove the nth index value from the string.md +++ b/Strings-Accept a string and remove the nth index value from the string.md @@ -15,8 +15,22 @@ To write a Python program that accepts a string and removes the character at a s 8. Print the final result. ## 💻 Program -Add Code Here +``` +def remove(a,n): + for i in range(0,len(a)): + if(i!=n): + print(a[i],end='') +a=input() +n=int(input()) +remove(a,n) +``` ## Output +image + + ## Result + +Thus the program has been successfully executed + diff --git a/Strings:Palindrome Check (Without Built-in Functions).md b/Strings:Palindrome Check (Without Built-in Functions).md index 70418a6d..2328377b 100644 --- a/Strings:Palindrome Check (Without Built-in Functions).md +++ b/Strings:Palindrome Check (Without Built-in Functions).md @@ -13,8 +13,23 @@ To write a Python program to check whether the string `"google"` is a **palindro ## 🧾 Program -Add code here +``` +string="google" + +if string==string[::-1]: + + print ("The entered string is palindrome") + +else: + + print ("The entered string is not palindrome") +``` ## Output +image + + ## Result + +Thus the given program is verified and executed sucessfully. diff --git a/Tuple: Check Element Existence.md b/Tuple: Check Element Existence.md index a3b31c14..3277c08b 100644 --- a/Tuple: Check Element Existence.md +++ b/Tuple: Check Element Existence.md @@ -10,8 +10,14 @@ To write a Python program that checks if the element `'n'` and the element `8` e 4. Print the results. ## 🧾 Program -Add code here - +``` +a=eval(input()) +print("n" not in a) +print("8" in a) +``` ## Output +image + ## Result +Thus the given program is verified and executed sucessfully