Thursday, August 29, 2019

Replace, Join, Split, Reverse, Uppercase & Lowercase in python


del keyword usage in python

"""
Created on Thu Aug 29 16:29:56 2019
@author: anil durgam
date:29-08-2019
"""
f = 11;
print(f)
  del f
print(f)

output:
    del f
    ^
IndentationError: unexpected indent

global key word usage in python

"""
Created on Thu Aug 29 16:29:56 2019
@author: anil durgam
date:29-08-2019
"""
f = 101;
print(f)
# Global vs.local variables in functions
def someFunction():
  global f
  print(f)
  f = "changing global variable"
someFunction()
print(f)


output:
101
101

changing global variable

declaration and re-declaration of the variable


"""
Created on Thu Aug 29 16:29:56 2019
@author: anil durgam
date:29-08-2019
"""
# Declare a variable and initialize it
f = 0
print(f)
# re-declaring the variable works
f = 'guru99'
print(f)

output:
0
guru99





example 3:


"""
Created on Thu Aug 29 16:29:56 2019
@author: anil durgam
date:29-08-2019
"""
# Declare a variable and initialize it
f = 101
print(f)
# Global vs. local variables in functions
def someFunction():
# global f
    f = 'I am learning Python'
    print(f)
someFunction()
print(f)

output:
101
I am learning Python

101

defination in python

"""
Created on Thu Aug 29 16:29:56 2019
@author: anil durgam
date:29-08-2019
"""
def main():
    print("hello world\n");
   
if __name__ =="__main__":
    main()
   
print("testing")

python class topic video