Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6824df1

Browse files
Add alt code: Fibonacci Member
Signed-off-by: Kunal Garg <kunalgarg2002@gmail.com>
1 parent 07a9435 commit 6824df1

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

‎7 Functions/Fibonacci Member alt.ipynb

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 18,
6+
"metadata": {},
7+
"outputs": [
8+
{
9+
"name": "stdout",
10+
"output_type": "stream",
11+
"text": [
12+
"true\n"
13+
]
14+
}
15+
],
16+
"source": [
17+
"def checkFib(n):\n",
18+
" if n==1 or n==0:\n",
19+
" return True\n",
20+
" a = 1\n",
21+
" b = 1\n",
22+
" while a<n:\n",
23+
" a, b = a+b, a\n",
24+
" if a==n:\n",
25+
" return True\n",
26+
" return False\n",
27+
"\n",
28+
"n = int(input())\n",
29+
"if checkFib(n):\n",
30+
" print(\"true\")\n",
31+
"else:\n",
32+
" print(\"false\")"
33+
]
34+
}
35+
],
36+
"metadata": {
37+
"kernelspec": {
38+
"display_name": "Python 3.10.4 64-bit",
39+
"language": "python",
40+
"name": "python3"
41+
},
42+
"language_info": {
43+
"codemirror_mode": {
44+
"name": "ipython",
45+
"version": 3
46+
},
47+
"file_extension": ".py",
48+
"mimetype": "text/x-python",
49+
"name": "python",
50+
"nbconvert_exporter": "python",
51+
"pygments_lexer": "ipython3",
52+
"version": "3.10.4"
53+
},
54+
"orig_nbformat": 4,
55+
"vscode": {
56+
"interpreter": {
57+
"hash": "369f2c481f4da34e4445cda3fffd2e751bd1c4d706f27375911949ba6bb62e1c"
58+
}
59+
}
60+
},
61+
"nbformat": 4,
62+
"nbformat_minor": 2
63+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /