We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c3e1720 commit e5a30bbCopy full SHA for e5a30bb
Assertions.py
@@ -0,0 +1,17 @@
1
+#Assertion in Python
2
+#assert statement used for debugging
3
+#two types of assert statements 1.simple version(without message)2. augmented version(with message)
4
+#syntax: assert condition_expression,message
5
+#if condition false then AsserionError
6
+#To disable assert statements for client py -O test.py
7
+def square_it(x):
8
+ return x*x
9
+
10
+assert square_it(2)==4,'Here result must be 4 but it is not'
11
+assert square_it(3)==9,'Here result must be 9 but it is not'
12
+assert square_it(4)==16,'Here result must be 16 but it is not'
13
14
+print(square_it(2))
15
+print(square_it(3))
16
+print(square_it(4))
17
+print(square_it(5))
0 commit comments