Tôi biết có nhiều giải pháp chính xác về chủ đề này nhưng tôi nghĩ sẽ thêm một vài cách thú vị để giải quyết vấn đề này. Nếu bạn đến từ C ++/C# hoặc Java, bạn sẽ có xu hướng sử dụng một cái gì đó như so sánh sau đó hành động bằng cách sử dụng chỉ mục để loại bỏ mục nhập không mong muốn trong vòng lặp. Python có chức năng xóa và del. Hủy bỏ chức năng Sử dụng giá trị và DEL sử dụng chỉ mục. Giải pháp Pythonic nằm trong hàm cuối cùng. Hãy xem làm thế nào chúng ta có thể làm điều đó:
Ở đây chúng tôi đang sử dụng chỉ mục trong chức năng FOR LOOP và DEL rất giống nhau trong C ++:
def remove_vol[str1]:
#list2 = list1 # this won't work bc list1 is the same as list2 meaning same container#
list1 = list[str1]
list2 = list[str1]
for i in range[len[list1]]:
if list1[i] in volwes:
vol = list1[i]
x = list2.index[vol]
del list2[x]
print[list2]
Sử dụng chức năng xóa:
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
Xây dựng chuỗi mới không chứa các ký tự không mong muốn bằng cách sử dụng các chỉ mục của chúng:
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
Tương tự như trong giải pháp ở trên nhưng sử dụng giá trị:
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
Làm thế nào bạn nên làm điều đó trong Python? Sử dụng danh sách hiểu! Nó thật đẹp:
def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
Phương pháp Python Python để lọc các nguyên âm trong một câu trả lời mã chuỗi.
def anti_vowel [c]:.
Báo chí = C ..
Phương pháp Python Python để lọc các nguyên âm trong một câu trả lời mã chuỗi.
def anti_vowel [c]:.
Báo chí = C ..
nguyên âm = ['a', 'e', 'i', 'o', 'u'].
Examples:
Input : welcome to geeksforgeeks Output : wlcm t gksfrgks Input : what is your name ? Output : wht s yr nm ?
cho x trong c. thấp hơn[]:.
Implementation:
C++14
#include
Nếu x trong nguyên âm:.
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
2def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
3def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
5def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
6def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
7def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
8def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
9def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
0def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
9def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
2def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
9def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
4def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
9def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
6def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
7Báo chí = Báo chí. thay thế [x, ""].
Trả lại báo ..
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
3Xem thảo luận
def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
9Input : welcome to geeksforgeeks Output : wlcm t gksfrgks Input : what is your name ? Output : wht s yr nm ?0
def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
6def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
3Input : welcome to geeksforgeeks Output : wlcm t gksfrgks Input : what is your name ? Output : wht s yr nm ?3
Input : welcome to geeksforgeeks Output : wlcm t gksfrgks Input : what is your name ? Output : wht s yr nm ?4
Input : welcome to geeksforgeeks Output : wlcm t gksfrgks Input : what is your name ? Output : wht s yr nm ?5
Input : welcome to geeksforgeeks Output : wlcm t gksfrgks Input : what is your name ? Output : wht s yr nm ?6
Input : welcome to geeksforgeeks Output : wlcm t gksfrgks Input : what is your name ? Output : wht s yr nm ?3
Input : welcome to geeksforgeeks Output : wlcm t gksfrgks Input : what is your name ? Output : wht s yr nm ?8
def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
6GksfrGks - Cmptr Scnc Prtl fr Gks0
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4GksfrGks - Cmptr Scnc Prtl fr Gks0
Cải thiện bài viết
GksfrGks - Cmptr Scnc Prtl fr Gks0
def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
2 GksfrGks - Cmptr Scnc Prtl fr Gks8
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
3def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4GksfrGks - Cmptr Scnc Prtl fr Gks1
GksfrGks - Cmptr Scnc Prtl fr Gks2
GksfrGks - Cmptr Scnc Prtl fr Gks3
GksfrGks - Cmptr Scnc Prtl fr Gks4
GksfrGks - Cmptr Scnc Prtl fr Gks5
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4GksfrGks - Cmptr Scnc Prtl fr Gks7
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4GksfrGks - Cmptr Scnc Prtl fr Gks4
#include
0GksfrGks - Cmptr Scnc Prtl fr Gks0
Java
Lưu bài viết
Đọc
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4#include
4 #include
9 using
0 using
1def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
3#include
2
def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
11def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
6using
9def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
52 def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
53def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4GksfrGks - Cmptr Scnc Prtl fr Gks4
def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
16def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
522____418def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
75def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
56 def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
90using
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
97using
def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
27Các
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
13def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
11def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
7def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
34def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
13def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
36GksfrGks - Cmptr Scnc Prtl fr Gks5
Input : welcome to geeksforgeeks Output : wlcm t gksfrgks Input : what is your name ? Output : wht s yr nm ?3
GksfrGks - Cmptr Scnc Prtl fr Gks0
def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
6GksfrGks - Cmptr Scnc Prtl fr Gks4
GksfrGks - Cmptr Scnc Prtl fr Gks5
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
13def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
44Input : welcome to geeksforgeeks Output : wlcm t gksfrgks Input : what is your name ? Output : wht s yr nm ?3
GksfrGks - Cmptr Scnc Prtl fr Gks0
def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
6GksfrGks - Cmptr Scnc Prtl fr Gks0
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4GksfrGks - Cmptr Scnc Prtl fr Gks0
GksfrGks - Cmptr Scnc Prtl fr Gks0
Python3
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
52 def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
53def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4GksfrGks - Cmptr Scnc Prtl fr Gks4
def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
16def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
522____418def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
75def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
56 def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
90def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
69def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
56 def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
84def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
86def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
87def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
75def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
56 def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
90def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
91def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
75def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
56 def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
94def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
91C#
using
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
97using
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
99using
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
01using
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
03#include
4 #include
5
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
06def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
07def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4#include
9 def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
10def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
3Các
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
13def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
37def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
6def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
39def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
6def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
41def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
13def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
43using
6 def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
45def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
13def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
0 def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
1def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
2 def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
50def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
51def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
7def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
53def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
13def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
55Input : welcome to geeksforgeeks Output : wlcm t gksfrgks Input : what is your name ? Output : wht s yr nm ?5
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
57def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
13def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
59def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
51GksfrGks - Cmptr Scnc Prtl fr Gks0
def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
6GksfrGks - Cmptr Scnc Prtl fr Gks0
def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
6GksfrGks - Cmptr Scnc Prtl fr Gks4
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
66def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4GksfrGks - Cmptr Scnc Prtl fr Gks0
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4#include
4 #include
9 using
0 def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
73def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
3def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
6def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
77def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
78GksfrGks - Cmptr Scnc Prtl fr Gks5
def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
6def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
81def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4GksfrGks - Cmptr Scnc Prtl fr Gks0
GksfrGks - Cmptr Scnc Prtl fr Gks0
JavaScript
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
85def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
86 def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
87def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
3def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
90def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
8def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
9def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
0def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
9def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
2def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
9def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
4def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
9def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
6def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
7Các
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
13Input : welcome to geeksforgeeks Output : wlcm t gksfrgks Input : what is your name ? Output : wht s yr nm ?555575
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
0def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
18def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
3def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
6def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
7 def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
23def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
6def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
3Input : welcome to geeksforgeeks Output : wlcm t gksfrgks Input : what is your name ? Output : wht s yr nm ?3
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
27def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
6GksfrGks - Cmptr Scnc Prtl fr Gks0
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4GksfrGks - Cmptr Scnc Prtl fr Gks0
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4GksfrGks - Cmptr Scnc Prtl fr Gks4
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
34GksfrGks - Cmptr Scnc Prtl fr Gks0
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
36def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
37 def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
38def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
39def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
40GksfrGks - Cmptr Scnc Prtl fr Gks5
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
42def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
43Đầu ra
GksfrGks - Cmptr Scnc Prtl fr Gks
Độ phức tạp về thời gian: O [n], trong đó n là độ dài của độ phức tạp của không gian chuỗi: O [1] O[n], where n is the length of the string
Space
Complexity: O[1]
Chúng ta có thể cải thiện giải pháp trên bằng cách sử dụng các biểu thức thông thường. & NBSP;
Implementation:
C++
#include
using
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
0 def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
1def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
2def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
3def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
51def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
52Input : welcome to geeksforgeeks Output : wlcm t gksfrgks Input : what is your name ? Output : wht s yr nm ?6
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4GksfrGks - Cmptr Scnc Prtl fr Gks4
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
56Input : welcome to geeksforgeeks Output : wlcm t gksfrgks Input : what is your name ? Output : wht s yr nm ?55____56
GksfrGks - Cmptr Scnc Prtl fr Gks0
def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
2 GksfrGks - Cmptr Scnc Prtl fr Gks8
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
3
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4GksfrGks - Cmptr Scnc Prtl fr Gks1
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
78def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
66def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
68def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4GksfrGks - Cmptr Scnc Prtl fr Gks4
#include
0GksfrGks - Cmptr Scnc Prtl fr Gks0
Java
#include
2
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
74#include
2
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
76#include
5
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
78def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
07def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4#include
9 def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
10def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
3Các
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4GksfrGks - Cmptr Scnc Prtl fr Gks0
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
13def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
43using
6 def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
45def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
3def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
6def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
77def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
78def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
04
def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
6def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
06def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4GksfrGks - Cmptr Scnc Prtl fr Gks0
GksfrGks - Cmptr Scnc Prtl fr Gks0
Python3
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
13def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
0 def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
1def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
2 def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
50def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
6GksfrGks - Cmptr Scnc Prtl fr Gks4
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
66def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4GksfrGks - Cmptr Scnc Prtl fr Gks0
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
75def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
56 def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
90def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
86def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
23C#
using
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
97def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4#include
4 #include
9 using
0 def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
73#include
5
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
78def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
3def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4#include
9 def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
10def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
3Các
def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
13def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
43using
6 def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
45def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4GksfrGks - Cmptr Scnc Prtl fr Gks0
def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4#include
4 #include
9 using
0 def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
73def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
3def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
6def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
77def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in range[len[list1]]:
if list1[i] not in volwes:
clean_str += ''.join[list1[i]]
print[clean_str]
78def remove_vol[str1]:
list1 = list[str1]
clean_str = ''
for i in list1:
if i not in volwes:
clean_str += ''.join[i]
print[clean_str]
66def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
6def remove_vol[list1]:
clean_str = ''.join[[x for x in list1 if x.lower[] not in volwes]]
print[clean_str]
59def remove_vol[str1]:
list1 = list[str1]
list2 = list[str1]
for i in list1:
if i in volwes:
list2.remove[i]
print[list2]
4GksfrGks - Cmptr Scnc Prtl fr Gks0
GksfrGks - Cmptr Scnc Prtl fr Gks0
Đầu ra
GksfrGks - Cmptr Scnc Prtl fr Gks
Độ phức tạp về thời gian: O [n], trong đó n là độ dài của độ phức tạp của không gian chuỗi: O [1] O[n], where n is the length of the string
Space Complexity: O[1]
Chúng ta có thể cải thiện giải pháp trên bằng cách sử dụng các biểu thức thông thường. & NBSP;Pramod Kumar. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to . See your article appearing on the GeeksforGeeks main page and help other Geeks.