Python String Manupulation Excercise Beginner : 01

Write a Python script that asks the user for a string and then prints the characters of the string in different lines


Write a Python script that asks the user for a string and then prints the characters of the string in different lines

Script:

string = input("Enter Any String\n") # Asking User To Enter A String.
for i in string:
  print(i)
Explanation:

The above script is the easiest first program we can write in the string manipulation.
You will take the input using the input() function, then store it in a variable.

After this, your objective will be fulfilled by just the magic of for loop. 

we will use the for loop to iterate over each character of the string with the help of in operator, then we will just print out each character we receive through the for loop variable i

See, Python is the easiest tool you got in your toolbox!.


Output:
Enter Any String
String Manupulation In Python Is Easy
S
t
r
i
n
g
M
a
n
u
p
u
l
a
t
i
o
n
I
n
P
y
t
h
o
n
I
s
E
a
s
y

Post a Comment

0 Comments