Python Tutorial
#!/usr/bin/python while True: # print("welcome to python pass statement learning!"); pass;Output:
$ python pass_test.py
#!/usr/bin/python for num in reversed([1, 2, 3, 4]): if num == 3: pass print("pass block"); else: print("number :%d" % num); print "done!"Output:
$ python pass_test.py number :4 pass block number :2 number :1 done!
class EmptyClass: pass;
class Student: pass; # Create an object for Empty Student Class student1 = Student(); # Fields of the object student1 student1.name = 'Student1'; student1.dept = 'computer science'; student1.mark = 90; print("name: %s" % student1.name); print("department: %s" % student1.dept); print("mark: %d" % student1.mark);Output:
$ python pass_empty_class.py name: Student1 department: computer science mark: 90
# Remember to implement this! def computeSalary(*args): pass;here pass statement is just ignored. here this computeSalary function needs to be implemented later.
Python Tutorial
Privacy Policy | Copyright2020 - All Rights Reserved. | Contact us | Report website issues in Github | Facebook page | Google+ page