Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
442efba
Update and rename README to README.md
ashwanidv100 Oct 18, 2017
ab86338
Update README.md
ashwanidv100 Oct 26, 2017
4d7e037
Add files via upload
ashwanidv100 Oct 27, 2017
396c82f
Update README.md
ashwanidv100 Oct 27, 2017
b135944
Update README.md
ashwanidv100 Oct 27, 2017
7bee128
Update README.md
ashwanidv100 Oct 27, 2017
0ed7fa3
Update README.md
ashwanidv100 Oct 27, 2017
5740547
Delete Python-Logo-PNG-Image.png
ashwanidv100 Oct 27, 2017
28db9b2
Update README.md
ashwanidv100 Oct 27, 2017
dab2a48
Update README.md
ashwanidv100 Oct 20, 2018
5b797ab
Update README.md
ashwanidv100 Oct 20, 2018
e2e0edc
Update README.md
ashwanidv100 Oct 20, 2018
07add53
Update 100+ Python challenging programming exercises.txt
ashwanidv100 Oct 20, 2018
445bf88
Merge branch 'master' into master
ashwanidv100 Oct 20, 2018
9bc3da5
Update README.md
ashwanidv100 Oct 20, 2018
b234dc1
Update README.md
ashwanidv100 Oct 20, 2018
fb3de09
Update README.md
ashwanidv100 Oct 20, 2018
1db4473
Update README.md
ashwanidv100 Oct 20, 2018
efdcf52
Update README.md
ashwanidv100 Oct 20, 2018
3be3928
Update README.md
ashwanidv100 Oct 20, 2018
6844de5
Update README.md
ashwanidv100 Oct 20, 2018
a4a559e
Update README.md
ashwanidv100 Oct 20, 2018
ecef397
Update README.md
ashwanidv100 Oct 20, 2018
071b57f
Update README.md
ashwanidv100 Oct 20, 2018
0485286
Update and rename 100+ Python challenging programming exercises.txt t…
ashwanidv100 Oct 25, 2018
326dd8c
Created using Colaboratory
ashwanidv100 Oct 25, 2018
4d7be97
codes working in Python 3.x
ashwanidv100 Oct 25, 2018
3d25e9d
Update README.md
ashwanidv100 Oct 25, 2018
0f3cdfa
Update README.md
ashwanidv100 Oct 25, 2018
13b8065
Update README.md
ashwanidv100 Oct 25, 2018
78300c7
Update README.md
ashwanidv100 Oct 25, 2018
edf781d
Update README.md
ashwanidv100 Oct 25, 2018
8180d33
Update README.md
ashwanidv100 Oct 25, 2018
46fb517
Your Python 3.x Version Solutions
ashwanidv100 Oct 25, 2018
6810780
Your Python 3.x Solution
ashwanidv100 Oct 25, 2018
7da616a
Your Python 3.x solutions
ashwanidv100 Oct 25, 2018
fffe890
Rename 100+_Python_challenging_programming_exercises_(_in_Python_3_x_…
ashwanidv100 Oct 25, 2018
f4ca881
Your Python 3.x solutions
ashwanidv100 Oct 25, 2018
029a80a
Update README
ashwanidv100 Oct 25, 2018
d5ea9df
Update README.md
ashwanidv100 Oct 26, 2018
cf1a03a
Your Python 3 Solutions
ashwanidv100 Oct 28, 2018
dbace6e
Your Python 3 Solutions
ashwanidv100 Oct 28, 2018
7273e8d
Delete 100+ Python challenging programming exercises(in Python 3.x).i…
ashwanidv100 Oct 28, 2018
d174e66
Update README.md
ashwanidv100 Oct 28, 2018
c020cee
Update 0-10 Python challenging programming exercises ( in Python 3.x …
ashwanidv100 Oct 28, 2018
aa51ca8
Update 0-10 Python challenging programming exercises ( in Python 3.x …
ashwanidv100 Oct 28, 2018
9e7a31a
Your Python 3 Solutions
ashwanidv100 Oct 28, 2018
19634e6
Update README.md
ashwanidv100 Oct 28, 2018
248068c
Update README.md
ashwanidv100 Oct 28, 2018
dc589c2
Update README.md
ashwanidv100 Oct 28, 2018
be6fbb4
Update README.md
ashwanidv100 Oct 28, 2018
c1c5c54
Update 100+ Python challenging programming exercises ( in Python 2x )
ashwanidv100 Mar 25, 2019
c0a3ff9
Delete python contents.txt
ashwanidv100 Mar 25, 2019
4e82dda
Added Question 11 to 20 in Python 3.
abhayku2002 Oct 18, 2020
45ea54b
Merge pull request #1 from abhayku2002/master
ashwanidv100 Oct 18, 2020
7743e06
Rename 11_20_Python_challenging_programming_exercises_(_in_Python_3_x…
abhayku2002 Oct 18, 2020
abbf9cb
Added 21-30 Question in Python 3.x
abhayku2002 Oct 18, 2020
7089812
Merge pull request #2 from abhayku2002/master
ashwanidv100 Oct 18, 2020
2c32d4d
Added 31-40 Questions in python 3.x
abhayku2002 Oct 25, 2020
9e3e65a
Added 31- 40 Questions in Python 3.x
abhayku2002 Oct 25, 2020
beae04e
Delete 31- 40 python programming exercise( in Python 3x ).ipynb
abhayku2002 Oct 25, 2020
b33682b
Rename 31_40_python_programming_exercise(_in_Python_3x_).ipynb to 31-…
abhayku2002 Oct 25, 2020
60f2e0d
Added 41 -50 Questions in Python 3.x
abhayku2002 Oct 25, 2020
b9dc010
Merge pull request #3 from abhayku2002/master
ashwanidv100 Oct 29, 2020
4f2d6a6
Update 0-10 Python challenging programming exercises ( in Python 3.x …
ashwanidv100 Oct 29, 2020
f616560
Rename 0-10 Python challenging programming exercises ( in Python 3.x …
ashwanidv100 Oct 29, 2020
85fe437
Added 51 - 60 python programming exercise in python 3
abhayku2002 Oct 29, 2020
27bf1ad
Merge pull request #4 from abhayku2002/master
ashwanidv100 Oct 29, 2020
ae115a7
Delete 100+ Python challenging programming exercises ( in Python 2x )
ashwanidv100 Dec 16, 2020
ac8b69d
Rename 31- 40 python programming exercise( in Python 3x ).ipynb to 31…
ashwanidv100 Dec 16, 2020
cfdc9e0
Rename 41 - 50 python programming exercise(in Pyhton 3.x).ipynb to 41…
ashwanidv100 Dec 16, 2020
67321cf
Rename 51 - 60 python programming exercise( in Python 3x ).ipynb to 5…
ashwanidv100 Dec 16, 2020
bf16030
Rename 31-40 python programming exercise( in Python 3x ).ipynb to 31-…
ashwanidv100 Dec 16, 2020
6f3a287
Added the remaining questions
ashwanidv100 Dec 16, 2020
dc12ae4
Rename 51-60 python programming exercise( in Python 3x ).ipynb to 51-…
ashwanidv100 Dec 16, 2020
83f21ef
Rename 41-50 python programming exercise(in Pyhton 3.x).ipynb to 41-5…
ashwanidv100 Dec 16, 2020
4f0f60f
Rename 21-30 Python challenging programming exercises(in Python 3x).i…
ashwanidv100 Dec 16, 2020
18a0576
Rename 21-30 Python Programming Exercises ( in Python 3.x ).ipynb to …
ashwanidv100 Dec 16, 2020
f13f11d
Rename 11-20 Python challenging programming exercises(in Python 3x).i…
ashwanidv100 Dec 16, 2020
83f033c
Rename 1-10 Python challenging programming exercises ( in Python 3.x …
ashwanidv100 Dec 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
697 changes: 697 additions & 0 deletions 1-10 Python Programming Exercise ( in Python 3.x ).ipynb

Large diffs are not rendered by default.

2,375 changes: 0 additions & 2,375 deletions 100+ Python challenging programming exercises.txt

This file was deleted.

714 changes: 714 additions & 0 deletions 11-20 Python Programming Exercise ( in Python 3.x ).ipynb

Large diffs are not rendered by default.

660 changes: 660 additions & 0 deletions 21-30 Python Programming Exercise ( in Python 3.x ).ipynb

Large diffs are not rendered by default.

600 changes: 600 additions & 0 deletions 31-40 Python Programming Exercise( in Python 3x ).ipynb

Large diffs are not rendered by default.

524 changes: 524 additions & 0 deletions 41-50 Python Programming Exercise (in Python 3.x ).ipynb

Large diffs are not rendered by default.

565 changes: 565 additions & 0 deletions 51-60 Python Programming Exercise ( in Python 3.x ).ipynb

Large diffs are not rendered by default.

592 changes: 592 additions & 0 deletions 61-70 Python Programming Exercise (in Python 3.x).ipynb

Large diffs are not rendered by default.

434 changes: 434 additions & 0 deletions 71-80 Python Programming Exercise (in Python 3.x).ipynb

Large diffs are not rendered by default.

475 changes: 475 additions & 0 deletions 81-90 Python Programming Exercise (in Python 3.x).ipynb

Large diffs are not rendered by default.

378 changes: 378 additions & 0 deletions 91-97 Python Programming Exercise (in Python 3.x).ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,378 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "91 - 97 python programming exercise( in Python 3x ).ipynb",
"provenance": [],
"collapsed_sections": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "xL3VHbHey50o"
},
"source": [
"# **Question 91**\n",
"With a given list [12,24,35,24,88,120,155,88,120,155], write a program to print this list after removing all duplicate values with original order reserved.\n",
"\n",
"**Hints: Use set() to store a number of values without duplicate.**"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "1V_O1rbwzeR4"
},
"source": [
"# **Solution:**"
]
},
{
"cell_type": "code",
"metadata": {
"id": "BtLgWhu7zh4_",
"outputId": "7cb6062b-ba6f-4cd9-ed2b-d68499ed4eb8",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"source": [
"def removeDuplicate( li ):\n",
" newli=[]\n",
" seen = set()\n",
" for item in li:\n",
" if item not in seen:\n",
" seen.add( item )\n",
" newli.append(item)\n",
"\n",
" return newli\n",
"\n",
"li=[12,24,35,24,88,120,155,88,120,155]\n",
"print(removeDuplicate(li))"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"[12, 24, 35, 88, 120, 155]\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "0W71XnaLzmlf"
},
"source": [
"# **Question 92**\n",
"Define a class Person and its two child classes: Male and Female. All classes have a method \"getGender\" which can print \"Male\" for Male class and \"Female\" for Female class.\n",
"\n",
"**Hints: Use Subclass(Parentclass) to define a child class.**"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "jCijO-Ztzwov"
},
"source": [
"# **Solution:**"
]
},
{
"cell_type": "code",
"metadata": {
"id": "yWh34PCpz0IK",
"outputId": "15dab1c6-ba8f-45d8-b2cc-7b5bb0546741",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"source": [
"class Person(object):\n",
" def getGender( self ):\n",
" return \"Unknown\"\n",
"\n",
"class Male( Person ):\n",
" def getGender( self ):\n",
" return \"Male\"\n",
"\n",
"class Female( Person ):\n",
" def getGender( self ):\n",
" return \"Female\"\n",
"\n",
"aMale = Male()\n",
"aFemale= Female()\n",
"print(aMale.getGender())\n",
"print(aFemale.getGender())"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"Male\n",
"Female\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "PvHydFUQz5qg"
},
"source": [
"# **Question 93**\n",
"Please write a program which count and print the numbers of each character in a string input by console.\n",
"\n",
"Example: \n",
"```\n",
" input: abcdefgabc\n",
" output: a,2 c,2 b,2 e,1 d,1 g,1 f,1\n",
"```\n",
"**Hints: Use dict to store key/value pairs. Use dict.get() method to lookup a key with default value.**"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Oo9CGj-s0Q18"
},
"source": [
"# **Solution:**"
]
},
{
"cell_type": "code",
"metadata": {
"id": "ctSRjKOW0TND",
"outputId": "d42e7d0e-4e45-49d9-90dd-324b7849ce88",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"source": [
"dic = {}\n",
"s=input()\n",
"for s in s:\n",
" dic[s] = dic.get(s,0)+1\n",
"print('\\n'.join(['%s,%s' % (k, v) for k, v in dic.items()]))"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"abcdefgabc\n",
"a,2\n",
"b,2\n",
"c,2\n",
"d,1\n",
"e,1\n",
"f,1\n",
"g,1\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "quPeVXQP0c6Z"
},
"source": [
"# **Question 94**\n",
"Please write a program which accepts a string from console and print it in reverse order.\n",
"\n",
"Example:\n",
"```\n",
" input: rise to vote sir\n",
" output: ris etov ot esir\n",
"```\n",
"**Hints: Use list[::-1] to iterate a list in a reverse order.**"
]
},
{
"cell_type": "code",
"metadata": {
"id": "e9pHmyb702P4",
"outputId": "95a8c4b6-bfcf-439c-e576-317825973af9",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"source": [
"s=input()\n",
"s = s[::-1]\n",
"print(s)"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"rise to vote sir\n",
"ris etov ot esir\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Z-V20iCX08z_"
},
"source": [
"# **Question 95**\n",
"Please write a program which accepts a string from console and print the characters that have even indexes.\n",
"\n",
"Example: \n",
"```\n",
" Input : H1e2l3l4o5w6o7r8l9d\n",
" Output : Helloworld\n",
"```\n",
"**Hints: Use list[::2] to iterate a list by step 2.**"
]
},
{
"cell_type": "code",
"metadata": {
"id": "4yuc02OR1TNe",
"outputId": "a0c0f601-2977-4756-e2dc-d16dbdafe764",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"source": [
"s=input()\n",
"s = s[::2]\n",
"print(s)"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"H1e2l3l4o5w6o7r8l9d\n",
"Helloworld\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ElNXsUwy1a7Q"
},
"source": [
"# **Question 96**\n",
"Please write a program which prints all permutations of [1,2,3]\n",
"\n",
"**Hints: Use itertools.permutations() to get permutations of list.**"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "fCLMDepk1kFl"
},
"source": [
"# **Solution:**"
]
},
{
"cell_type": "code",
"metadata": {
"id": "HLVeiDog1mDn",
"outputId": "1c873bfc-2958-4e0d-98d5-e073a26f7831",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"source": [
"import itertools\n",
"print(list(itertools.permutations([1,2,3])))"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"[(1, 2, 3), (1, 3, 2), (2, 1, 3), (2, 3, 1), (3, 1, 2), (3, 2, 1)]\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "19xpFIvs1pzr"
},
"source": [
"# **Question 97**\n",
"Write a program to solve a classic ancient Chinese puzzle: We count 35 heads and 94 legs among the chickens and rabbits in a farm. How many rabbits and how many chickens do we have?\n",
"\n",
"**Hint: Use for loop to iterate all possible solutions.**"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "cKjD49db1yGa"
},
"source": [
"# **Solution:**"
]
},
{
"cell_type": "code",
"metadata": {
"id": "6rG3dkbH10Ye",
"outputId": "67b88a85-9dda-42ed-f90e-fa026883bb55",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"source": [
"def solve(numheads,numlegs):\n",
" ns='No solutions!'\n",
" for i in range(numheads+1):\n",
" j=numheads-i\n",
" if 2*i+4*j==numlegs:\n",
" return i,j\n",
" return ns,ns\n",
"\n",
"numheads=35\n",
"numlegs=94\n",
"solutions=solve(numheads,numlegs)\n",
"print(solutions)"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"(23, 12)\n"
],
"name": "stdout"
}
]
}
]
}
Empty file removed README
Empty file.
Loading