String Handling

0

String Handling

  • String is a collections of words stored on the basis of index and immutable by nature.

1. Static

  • The string which never changes during execution.

                                Ex : data = "The quick brown fox jumps over the little lazy dog"

2. Dynamic

  • We can never alter a string but we can load something to a string.

  • Using C language Standard

%s  --- String

%d --- Integer

%f --- Float --> %numberf -->%.4f

 

Saved String

data = """

                Number:%d

                Float number%.4f

                String:%s

"""

int_var = int(input("Enter Integer Value : "))

float_var = float(input("Enter Number Only : "))

str_var = input("Enter String Value : "))

print(data%(int_var,float_var,str_var)

Anonymous Object

                       int_var = int(input("Enter Inger Value : "))

                       float_var = float(input("Enter Number Only : "))

                       str_var = input("Enter String Value : ")

                       print("""

                                      Number:%d

                                      Float Number%.4f

                                      String:%s

                               """%(int_var,float_var,str_var))

Tags

Post a Comment

0Comments
Post a Comment (0)