Skip to content

Commit 0788fa2

Browse files
committed
python
1 parent 2a38f54 commit 0788fa2

File tree

6 files changed

+590
-22
lines changed

6 files changed

+590
-22
lines changed

Data Structures/List.ipynb

-7
Original file line numberDiff line numberDiff line change
@@ -326,13 +326,6 @@
326326
"print(apps)\n",
327327
"print(b)"
328328
]
329-
},
330-
{
331-
"cell_type": "code",
332-
"execution_count": null,
333-
"metadata": {},
334-
"outputs": [],
335-
"source": []
336329
}
337330
],
338331
"metadata": {

Function.ipynb

+137-2
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,14 @@
296296
},
297297
{
298298
"cell_type": "code",
299-
"execution_count": 68,
299+
"execution_count": 1,
300300
"metadata": {},
301301
"outputs": [
302302
{
303303
"name": "stdout",
304304
"output_type": "stream",
305305
"text": [
306-
"Temp in Fahrenheir: 89.6 F\n"
306+
"Temp in Fahrenheir: 95.0 F\n"
307307
]
308308
}
309309
],
@@ -318,6 +318,141 @@
318318
"temp(temperature)"
319319
]
320320
},
321+
{
322+
"cell_type": "code",
323+
"execution_count": 6,
324+
"metadata": {},
325+
"outputs": [
326+
{
327+
"name": "stdout",
328+
"output_type": "stream",
329+
"text": [
330+
"52 is the maximum number.\n"
331+
]
332+
}
333+
],
334+
"source": [
335+
"# find maximum of 3 numbers\n",
336+
"def maximum(a,b,c):\n",
337+
" if(a>=b and a>=c):\n",
338+
" return a\n",
339+
" elif(b>=a and b>=c):\n",
340+
" return b\n",
341+
" else:\n",
342+
" return c\n",
343+
"\n",
344+
"a=int(input('enter first number: '))\n",
345+
"b=int(input('enter second number: '))\n",
346+
"c=int(input('enter third number: '))\n",
347+
"res=maximum(a,b,c)\n",
348+
"print(res,\"is the maximum number.\")\n"
349+
]
350+
},
351+
{
352+
"cell_type": "code",
353+
"execution_count": 9,
354+
"metadata": {},
355+
"outputs": [
356+
{
357+
"name": "stdout",
358+
"output_type": "stream",
359+
"text": [
360+
"Factorial of 6 is : 720\n"
361+
]
362+
}
363+
],
364+
"source": [
365+
"# program to calculate factorial\n",
366+
"def fact(num):\n",
367+
" a=1\n",
368+
" for i in range(1,num+1):\n",
369+
" a=a*i\n",
370+
" print('Factorial of ',num,'is : ',a)\n",
371+
"\n",
372+
"num=int(input('enter the number: '))\n",
373+
"fact(num)"
374+
]
375+
},
376+
{
377+
"cell_type": "code",
378+
"execution_count": 28,
379+
"metadata": {},
380+
"outputs": [
381+
{
382+
"name": "stdout",
383+
"output_type": "stream",
384+
"text": [
385+
"reveresed string: elppa\n"
386+
]
387+
}
388+
],
389+
"source": [
390+
"# reverse of a string\n",
391+
"def reverse(a):\n",
392+
" b=''\n",
393+
" l=len(a)\n",
394+
" for i in range(-1,-(l+1),-1):\n",
395+
" b=b+a[i]\n",
396+
" print(\"reveresed string: \",b)\n",
397+
"\n",
398+
"\n",
399+
"a=input('enter the string: ')\n",
400+
"reverse(a)"
401+
]
402+
},
403+
{
404+
"cell_type": "code",
405+
"execution_count": 38,
406+
"metadata": {},
407+
"outputs": [
408+
{
409+
"name": "stdout",
410+
"output_type": "stream",
411+
"text": [
412+
"EducAtiOn has 5 Vowels.\n"
413+
]
414+
}
415+
],
416+
"source": [
417+
"# to count vowels in a string\n",
418+
"def vowel(s):\n",
419+
" c=0\n",
420+
" for i in s:\n",
421+
" if i in ('a','e','i','o','u','A','E','I','O','U'):\n",
422+
" c+=1\n",
423+
" else:\n",
424+
" continue\n",
425+
" return c\n",
426+
"\n",
427+
"st=input('enter a string: ')\n",
428+
"res=vowel(st)\n",
429+
"print(st,'has ',res,'Vowels.')\n"
430+
]
431+
},
432+
{
433+
"cell_type": "code",
434+
"execution_count": 40,
435+
"metadata": {},
436+
"outputs": [
437+
{
438+
"name": "stdout",
439+
"output_type": "stream",
440+
"text": [
441+
"BMI is : 22.650586999334745\n"
442+
]
443+
}
444+
],
445+
"source": [
446+
"# to calculate BMI\n",
447+
"def bmi(wt,ht):\n",
448+
" res=(wt/(ht*ht))\n",
449+
" return res\n",
450+
"weight=float(input('enter weight in Kg: '))\n",
451+
"height= float(input('enter height in Metres: '))\n",
452+
"result=bmi(weight,height)\n",
453+
"print('BMI is : ', result)"
454+
]
455+
},
321456
{
322457
"cell_type": "markdown",
323458
"metadata": {},

Loops.ipynb

-7
Original file line numberDiff line numberDiff line change
@@ -358,13 +358,6 @@
358358
"for i, v in enumerate(fruits):\n",
359359
" print(f'{i}. {v}')"
360360
]
361-
},
362-
{
363-
"cell_type": "code",
364-
"execution_count": null,
365-
"metadata": {},
366-
"outputs": [],
367-
"source": []
368361
}
369362
],
370363
"metadata": {

0 commit comments

Comments
 (0)