-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhello-world.py
65 lines (47 loc) · 1.6 KB
/
hello-world.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#print(2**3)
#red_bucket = input("What do you want to put in the bucket? ")
#print(red_bucket)
#print(5!=4)
#=====================================================
#ZIRI_AGE = 5
#AGE_at_KINDERGARTEN = 5
#print(ZIRI_AGE!=AGE_at_KINDERGARTEN)
#if ZIRI_AGE < AGE_at_KINDERGARTEN:
#print("Ziri should be in pre-school")
#elif ZIRI_AGE == AGE_at_KINDERGARTEN:
#print("Enjoy Kindergarten!")
#else:
#print("Ziri should be in another class")
#=====================================================
# import re
# def camel_to_snake(paramString):
# '''camelCase > camel_case'''
# pattern = re.compile(r'(?<!^)(?=[A-Z])')
# paramString = pattern.sub('_', paramString).lower()
# return paramString
# Python implementation of substituting a
# specific text pattern in a string using regex
# importing regex module
import re
# Function to perform
# operations on the strings
def substitutor():
# a string variable
sentence1 = "It is raining outside."
# replacing text 'raining' in the string
# variable sentence1 with 'sunny' thus
# passing first parameter as raining
# second as sunny, third as the
# variable name in which string is stored
# and printing the modified string
print(re.sub(r"raining", "sunny", sentence1))
# a string variable
sentence2 = "Thank you very very much."
# replacing text 'very' in the string
# variable sentence2 with 'so' thus
# passing parameters at their
# appropriate positions and printing
# the modified string
print(re.sub(r"very", "so", sentence2))
# Driver Code:
substitutor()