We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dfc29a8 commit af120e7Copy full SHA for af120e7
Sprint5/double.py
@@ -0,0 +1,21 @@
1
+def double(n):
2
+ return n*2
3
+num = double("22")
4
+print(num)
5
+
6
+#my prediction is that it would return 2222. As python will treat 22 as a string being a strongly typed language.
7
+#if it was javascript * operator would have forced numeric converion and 22 string would have become 22 int and 44 would
8
+#have been returned
9
+# when I run the file it returns 2222 as expected.
10
11
+# 2nd exercise- original function :
12
+def double(number):
13
+ return number * 3
14
15
+print(double(10)) # returns "30"
16
17
+#so we either change the name of the function to triple or multiply number with 2 rather than 3
18
+def triple(number):
19
20
21
+print(triple(10)) # returns "30"
0 commit comments