We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dd06ec1 commit f2eca40Copy full SHA for f2eca40
unit3_ex3.4.2.py
@@ -0,0 +1,22 @@
1
+# exercise 3.4.2 from unit main
2
+'''
3
+Write a program that accepts a string of his choice from the user.
4
+The program will print to the screen a string in which all occurrences
5
+of the first character have been replaced by the character 'e', except for the first
6
+character itself.
7
+
8
+example:
9
+Please enter a string: ddar astronaut. pldase, stop drasing md!
10
+dear astronaut. please, stop erasing me!
11
12
13
14
+str = input("Enter a string: ")
15
+char_to_replace = str[0]
16
+if(len(str) > 1):
17
+ output = str[0] + str[1:].replace(char_to_replace, 'e')
18
+else:
19
+ output = str[0]
20
21
+print(output)
22
0 commit comments