We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 499ddcf commit 37dd0b0Copy full SHA for 37dd0b0
Assertions/AssertionDemo.py
@@ -0,0 +1,15 @@
1
+#Assertions are used for debbuging purpose
2
+#By default, assertions are enabled in python
3
+#To run py file by disabling assertions on client machine,run using py -O file_name.py
4
+
5
+def square_it(x):
6
+ return x*x
7
8
9
+assert square_it(2)==4,"The Square of 2 is 4"
10
+assert square_it(3)==9,"The Square of 3 is 9"
11
+assert square_it(5)==25,"The Square of 5 is 25"
12
13
+print(square_it(2))
14
+print(square_it(4))
15
+print(square_it(5))
0 commit comments