Code 10: 3 Ways to remove space from a string in Python | 365 Days of Code

preview_player
Показать описание
Python program to remove space from a string.
Code -
# Python Program to remove space from a string
string = "Hello, This is Mayank Gupta, and I run Code House"
# Method 1
print("Sol 1 - ", new_string_1)

# Method 2
print("Sol 2 - ", new_string_2)

# Method 3
new_string_3 = ""
for each in string:
if each != " ":
new_string_3 += each
print("Sol 3 - ", new_string_3)
# Thanks
Рекомендации по теме