File tree Expand file tree Collapse file tree 2 files changed +72
-0
lines changed Expand file tree Collapse file tree 2 files changed +72
-0
lines changed Original file line number Diff line number Diff line change 1+ # Python String Variable Demostration
2+
3+ # Declaration
4+
5+ #String Declaration with single quote for single line display
6+ x = ''
7+ print (x )
8+
9+ #String Declaration with double quote for single line display
10+ x = " "
11+ print (x )
12+
13+ #String Declaration with multi line print with single quote
14+ x = '''Hello
15+ This is Python Multiline
16+ demo
17+ '''
18+ print (x )
19+
20+
21+ #String Declaration with multi line print with double quote
22+ x = """Hello
23+ This is Python Multiline
24+ demo
25+ """
26+ print (x )
27+
28+ #How print works
29+ x = 'hello'
30+ #variable will br printed
31+ print (x )
32+
33+ #x as a string will be printted
34+ print ('x' )
35+
36+ #x as a string will be printted
37+ print ("x" )
38+
39+ #variable x will be printed in string conversation
40+ print (str (x ))
41+
42+ #repr() representation that has all information
43+ print (repr (x ))
Original file line number Diff line number Diff line change 1+ # Python String Variable Demostration
2+
3+ # Declaration
4+ x = "python"
5+
6+ #condition in string with small latter
7+ print ('t' in x )
8+
9+
10+ #condition in string with capital latter
11+ print ('T' in x )
12+
13+ #String print
14+ print (x )
15+
16+ # String lenght printed
17+ print (len (x ))
18+
19+ #How to add new line in print
20+ x = "Python\n Test"
21+ print (x )
22+
23+ #How to add new line in print
24+ x = 'Python\n Test'
25+ print (x )
26+
27+ #How to avoide special character
28+ x = r'Python\nTest'
29+ print (x )
You can’t perform that action at this time.
0 commit comments