Search Results
| Search type | Search syntax |
|---|---|
| Tags | [tag] |
| Exact | "words here" |
| Author | user:1234 user:me (yours) |
| Score | score:3 (3+) score:0 (none) |
| Answers | answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
| Views | views:250 |
| Code | code:"if (foo != bar)" |
| Sections | title:apples body:"apples oranges" |
| URL | url:"*.example.com" |
| Saves | in:saves |
| Status | closed:yes duplicate:no migrated:no wiki:no |
| Types | is:question is:answer |
| Exclude | -[tag] -apples |
| For more details on advanced search visit our help page | |
Results tagged with python
Search options not deleted user 210397
Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability. Use the python tag for all Python related questions. If you believe your question may be even more specific, you can include a version specific tag such as python-3.x.
2 votes
A function that returns all letters in the Alphabet except the ones in a pre-defined list
I suggest you check PEP0008 https://www.python.org/dev/peps/pep-0008/ the official Python style guide and Flake8 http://flake8.pycqa.org/en/latest/ as a tool for style enforcement. … Docstrings: Python documentation strings or docstrings are a way of documenting your classes/function/modules and are usually accessed through help(). …
6 votes
Accepted
python search replace and join with delimiter
= ("lorem","ipsum","dolor", "fright", "nec","pellentesque","eu", "pretium","quis","sem","nulla","consequat","massa","quis",) According to PEP0008 which I recommend checking for being the official Python …
4 votes
Largest number order in string
Adding to strings: largest += largest_num This form is inefficient, a string is immutable in Python and each time you're adding to largest a new string is created and assigned to the new value. …
10 votes
5 answers
4k views
Leetcode two sum
I'm currently learning c++ coming from a python background, so I'll include a solution in python and in c++ for the following problem statement: Given an array of integers nums and an integer target, … Memory Usage: 14.4 MB, less than 49.82% of Python online submissions for Two Sum. …
8 votes
2 answers
1k views
Leetcode longest substring without repeating characters
Link here I'm currently learning c++ coming from a python background, so I'll include a solution in python and in c++ for the following problem statement and based on very helpful answers obtained on my … Example 1: Input: s = "abcabcbb" Output: 3 Example 2: Input: s = "bbbbb" Output: 1 I would like to improve speed for both python and c++ implementations, and I need to improve memory consumption in the …
1 vote
1 answer
488 views
Longest common prefix (Leetcode)
Link here I'm currently learning c++ coming from a python background, so I'll include a solution in python and in c++ for the problem statement below, I'm including both for convenience, if you don't know … c++, feel free to review python and vice versa. …
2 votes
1 answer
409 views
Leetcode atoi (string to integer)
link here I'll include a solution in Python and C++ and you can review one. … I'm mostly interested in reviewing the C++ code which is a thing I recently started learning; those who don't know C++ can review the Python code. …
7 votes
3 answers
2k views
Leetcode valid sudoku
Link here I'll include a solution in Python and C++ and you can review one. … I'm mostly interested in reviewing the C++ code which is a thing I recently started learning; those who don't know C++ can review the Python code. …
1 vote
1 answer
277 views
Leetcode group anagrams
Link here I'll include a solution in Python and C++ and you can review one. … Surprisingly, python solution outperforms the c++ solution almost by 2x. The resulting times ~= 10, 20 seconds for python and c++ respectively when run on my i5 2.7 GHZ mbp. …
4 votes
1 answer
329 views
Leetcode, longest palindromic substring
Here's a link Given a string s, return the longest palindromic substring in s. A string is called a palindrome string if the reverse of that string is the same as the original string. Example 1: In …
2 votes
4 answers
340 views
Leetcode minimum path sum
Link here I'll include a solution in Python and C++ and you can review one. … I'm mostly interested in reviewing the C++ code which is a thing I recently started learning; those who don't know C++ can review the Python code. …
1 vote
1 answer
124 views
Leetcode spiral matrix
Link here I'll include a solution in Python and C++ and you can review one. … I'm mostly interested in reviewing the C++ code which is a thing I recently started learning; those who don't know C++ can review the Python code. …
1 vote
1 answer
214 views
Leetcode longest valid parentheses
Link here I'll include a solution in Python and C++ and you can review one. … I'm mostly interested in reviewing the C++ code which is a thing I recently started learning; those who don't know C++ can review Python code. …
5 votes
Accepted
Program to print the multiple occurrence of numbers in a list
Style Check PEP0008 the official Python style guide for maintaining code within Python acceptable standards. … Augmented assignment: Python supports augmented assignments ex: i=i-1 is i -= 1, count=count+1 is count += 1 ... …
5 votes
Accepted
Get list of all combinations from a set
Style I suggest you check PEP0008 https://www.python.org/dev/peps/pep-0008/ the official Python style guide while writing your code and the following goes accordingly: Docstrings: Python Docstring is … Docstrings are accessible from the doc attribute for any of the Python object and also with the built-in help() function can come in handy. …