The repository is about 100+ python programming exercise problem discussed, explained, and solved in different ways

Overview

Break The Ice With Python

A journey of 100+ simple yet interesting problems which are explained, solved, discussed in different pythonic ways

Binder
Deepnote


Introduction

The exercise text contents of this repository was collected from GitHub account of zhiwehu. I collected it to practice and solve all the listed problems with python. Even after these collected problems are all set up, I will try to add more problems in near future. If you are a very beginner with python then I hope this 100+ exercise will help you a lot to get your hands free with python.

One will find the given problems very simple and easy to understand. A beginner can try 3-5 problems a day which will take a little time to solve but definitely will learn a couple of new stuff (no matter how lazy you are :P ). And after regular practice of only a month, one can find himself solved more than 100++ problems which are obviously not a deniable achievement.

In this repository, I will be gradually updating the codebase of the given problems with my own solutions. Also, I may try to explain the code and tell my opinion about the problem if needed. Main Authors solutions are in python 2 & my solutions will be in python 3. Every problem is divided into a template format which is discussed below. There is a discussion section so don't forget to share your opinion, ideas and feel free to discuss anything wrong or mistake

A Big Thanks to apurvmishra99 for contributing the repository by cleaning up the formatting of all Days_.md files. fixing some random errors, fixing some variable naming with PEP8 conventions, and adding a whole new folder of jupyter notebook of all 24 days.


100+ Python challenging programming exercises

1. Problem Template

  • Question
  • Hints
  • Solution

2. Practice Status

Comments
  • Python program to find a row max 1s in an array with 0s and 1s

    Python program to find a row max 1s in an array with 0s and 1s

    Hello,

    I am looking for the most efficient way of writing a program of array with binary values (0s and 1s) to find a row with max number of 1s. For example if row 3 has max 1s then output should print row = 3

    opened by mishrasunny-coder 3
  • Add Deepnote launch button

    Add Deepnote launch button

    Hi there, I'm Dan from Deepnote. We're a small startup creating a better data science notebook compatible with Jupyter and one of the things we're really interested is making it easier for people to try and learn from existing projects. I was trying out Deepnote with some interesting public repos, including yours and since I already set it up for myself, I thought it might be useful for others too to have a one-click button to run your repo, so I submitted a PR. Compared to binder, Deepnote offers more advanced features like collaboration or persistent environment so people can save their progress and come back to it later.

    Hope you find it useful, and thanks for your work!

    opened by danzvara 1
  • Correction in a Solution of Question 3

    Correction in a Solution of Question 3

    For Question 3, Corrected an existing solution

    '''Solution by: yurbika '''

    num = int(input("Number: ")) print(dict(list(enumerate((i * i for i in range(num+1)))))) #incorrect: output produced starts from {0: 0, 1: 1, ......}

    print(dict(enumerate([i*i for i in range(1, num+1)], 1))) #correct: output produced starts from {1: 1, 2: 4, .......}

    opened by ghost 1
  • Question 9:

    Question 9:

    Question 9: Write a program that accepts sequence of lines as input and prints the lines after making all characters in the sentence capitalized.

    Suppose the following input is supplied to the program:

    Hello world Practice makes perfect

    My answer is given below:

    x = input()

    print(str(x).upper())

    opened by abdulwagab 1
  • Cleanup of all markdown files and addition of jupyter notebooks for all days

    Cleanup of all markdown files and addition of jupyter notebooks for all days

    Hi,

    So I have cleaned up the formatting of all Days_*.md files and fixed some random errors wherever I found them. Additionally, I have created a notebooks folder with all 24 days as jupyter notebooks. I have taken the liberty to remove all Python 2 solutions considering the problem of running Python 3 and 2 together in a notebook and also considering the end of support for it. I have strived to retain as much original content as possible and have formatted it black and tried to fix some variable naming with PEP8 conventions.

    The jupyter notebooks can be accessed directly via the binder link added on the README.

    opened by apurvmishra99 1
  • Question 11

    Question 11 "for loop | if statement" problem

    Why this code behave in such a strange way?

    Here is the problem:

    Write a program which accepts a sequence of comma separated 4 digit binary numbers as its input and then check whether they are divisible by 5 or not. The numbers that are divisible by 5 are to be printed in a comma separated sequence.

    Example:

    0100,0011,1010,1001

    Then the output should be:

    1010

    Notes: Assume the data is input by console.

    Here is my solution:

    resultat equals to sum of values, multiplied by their symbols

    values start from 1 and doubles for each next symbol

    symbols can be only 1 or 0

    binary_numbers = input('Write a sequance of comma and whitespace(, ) separated 4 digit binary numbers(0,1): ').split(', ')

    for number in binary_numbers: value = 1 res = 0 for digit in number[::-1]: res += int(digit) * value value *= 2 # print(res) if (res % 5) == True: binary_numbers.remove(number)

    print(', '.join(binary_numbers))

    so, if we print out "res"s, with "0100, 0011, 1010, 1001" as input, we would have 4, 3, 10, 9 as output

    and out for:

    print(bool(4 % 5)) print(bool(3 % 5)) print(bool(10 % 5)) print(bool(9 % 5))

    will be:

    True True False True

    so, it should work, but it doesn't

    I assumed, that problem is in the list removing and wrote this piece of code:

    ml = ['asdasd', 'dfdffdf', 'ssdsdfsdfsdfsdfdfdfddd', 'asdasdasdssssss']

    for item in ml: print(item, len(item)) if len(item) > 6: ml.remove(item)

    and, all of a sudden, it doesn't work too, the output is:

    asdasd 6 dfdffdf 7 asdasdasdssssss 15 ['asdasd', 'ssdsdfsdfsdfsdfdfdfddd']

    but length of the third(2) item of a list is obviously bigger than 6, so, looks like this code has been completely skipping the 'ssdsdfsdfsdfsdfdfdfddd' value. Further more, if we comment out the "if" block, it will see this value in the list and print its length

    in:

    ml = ['asdasd', 'dfdffdf', 'ssdsdfsdfsdfsdfdfdfddd', 'asdasdasdssssss']

    for item in ml: print(item, len(item)) # if len(item) > 6: # ml.remove(item)

    out:

    asdasd 6 dfdffdf 7 ssdsdfsdfsdfsdfdfdfddd 22 asdasdasdssssss 15

    I completely don't inderstand what is going on between for loop and conditional if statement.

    Is anybody knows?

    opened by LzrdDragon 0
  • Day 1 , Question 3 Enhancement

    Day 1 , Question 3 Enhancement

    For Question 3:

    def integral(num):
    temp_list=[item for item in range(1, num)] return { item: item*item for item in temp_list}

    inputs = int(input("Please a number")) integral(inputs)

    opened by eyespywmlileye 0
  • Day 2 Question 9

    Day 2 Question 9

    in this program every second string is being saved and every odd string is skipped.

    Solution: change while input(): to while True: and it will be solved like below:

    Why do every second line is storing in the list and all odd lines are skipped?

    lst = []

    while True: x = input() if len(x) != 0: lst.append(x.upper()) else: break

    print(lst) for line in lst: print(line)

    opened by Jugnupapa 0
Owner
Abdullah Al Masud Tushar
Software Engineer | Certified AWS Solutions Architect Associate | Certified PSM | Sports Programmer | Mindful & Techy Realm Explorer
Abdullah Al Masud Tushar
Object-oriented programming exercise session held in Petnica.

OOP vežba ⚠️ The code in this repo is used for a OOP practice session held in Petnica. All instructions in the README file are written in Serbian. Ops

Pavle Ćirić 1 Jan 30, 2022
Advanced Developing of Python Apps Final Exercise

Advanced-Developing-of-Python-Apps-Final-Exercise This is an exercise that I did for a python advanced learning course. The exercise is divided into t

Alejandro Méndez Fernández 1 Dec 4, 2021
A simple but complete exercise to learning Python

ResourceReservationProject This is a simple but complete exercise to learning Python. Task and flow chart We are going to do a new fork of the existin

null 2 Nov 14, 2022
Exercise to teach a newcomer to the CLSP grid to set up their environment and run jobs

Exercise to teach a newcomer to the CLSP grid to set up their environment and run jobs

Alexandra 2 May 18, 2022
100 Days of Python Programming

100 days of Python Following the initiative of my friend Helber Belmiro, who is almost done with his 100 days of Java, I have decided to start my 100

Henrique Pereira 19 Nov 8, 2021
"Cambio de monedas" Change-making problem with Python, dynamic programming best solutions,

Change-making-problem / Cambio de monedas Entendiendo el problema Dada una cantidad de dinero y una lista de denominaciones de monedas, encontrar el n

Juan Antonio Ayola Cortes 1 Dec 8, 2021
A chain of stores wants a 3-month demand forecast for its 10 different stores and 50 different products.

Demand Forecasting Objective A chain store wants a machine learning project for a 3-month demand forecast for 10 different stores and 50 different pro

null 2 Jan 6, 2022
This repository requires you to solve a problem by writing some basic python code.

Can You Solve a Problem? A beginner friendly repository that requires you to solve familiar problems with python. This could be as simple as implement

Precious Kolawole 11 Nov 30, 2022
an opensourced roblox group finder writen in python 100% free and virus-free

Roblox-Group-Finder an opensourced roblox group finder writen in python 100% free and virus-free note : if you don't want install python or just use w

mollomm1 1 Nov 11, 2021
Registro Online (100% Python-Mysql)

Registro elettronico scritto in python, utilizzando database Mysql e Collegando Registro elettronico scritto in PHP

Sergiy Grimoldi 1 Dec 20, 2021
A 100% python file organizer. Keep your computer always organized!

PythonOrganizer A 100% python file organizer. Keep your computer always organized! To run the project, just clone the folder and run the installation

null 3 Dec 2, 2022
This repository containing cross-section cut and fill calculations using Python programming language.

cross-section This repository is containing cut and fill calculations for cross-section using Python programming language. This codes is made to calcu

null 3 Jun 15, 2022
Hacking and Learning consistently for 100 days straight af.

#100DaysOfHacking Hacking and Learning consistently for 100 days straight af. [yes, no breaks except mental-break ones, Obviously.] This Repo is one s

FENIL SHAH 17 Sep 9, 2022
We want to check several batch of web URLs (1~100 K) and find the phishing website/URL among them.

We want to check several batch of web URLs (1~100 K) and find the phishing website/URL among them. This module is designed to do the URL/web attestation by using the API from NUS-Phishperida-Project.

null 3 Dec 28, 2022
Nimbus - Open Source Cloud Computing Software - 100% Apache2 licensed

⚠️ The Nimbus infrastructure project is no longer under development. ⚠️ For more information, please read the news announcement. If you are interested

Nimbus 194 Jun 30, 2022
A simple solution for water overflow problem in Python

Water Overflow problem There is a stack of water glasses in a form of triangle as illustrated. Each glass has a 250ml capacity. When a liquid is poure

Kris 2 Oct 22, 2021
Manually Install Python 2.7 pip without any problem !

Python2.7_install_pip Manually Install Python 2.7 pip without any problem ! Download installPip.py to your system and Run the code using this Command

Ali Jafari 1 Dec 9, 2021
Python Common things by Problem Fighter Library, (Exception, Debug Log, etc.)

In the name of God, the Most Gracious, the Most Merciful. PF-PY-Common Documentation Install and update using pip: pip install -U xxxx Please find the

Problem Fighter 3 Jan 15, 2022