PythonExercises | Exercises for Python beginners | Learning library
kandi X-RAY | PythonExercises Summary
kandi X-RAY | PythonExercises Summary
Exercises for Python beginners. This are made-up exercises I did for friends learning Python. Difficulty may increase with the number of exercises I add in the future.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Solve the Sudoku problem
- Get the neighbors of a triangle
- Update the player
- Read the Sudoku from a string
- Visualize the Sudoku
- Checks if a Sudoku is solved
- Returns a list of all the squares in the Sudoku
- Get the columns of the Sudoku
- Generate a sequence of line numbers
- Update a player
- Displays the cell
PythonExercises Key Features
PythonExercises Examples and Code Snippets
Community Discussions
Trending Discussions on PythonExercises
QUESTION
I'm new to Python and I'm trying to do the following exercise:
With the for loop, take the following list and sort it based on the sum of the values of the tuples of the list: [(1,5),(9,0),(12,3),(5,4),(13,6),(1,1)]
However, when I write the following code:
...ANSWER
Answered 2020-Jul-07 at 15:47The main issue here lies in the line for i in tuple1
.
Your tuple1
is [1,9,12,5,13,1]
. When i=9
, you list is clearly out of range(its length is only 6). Use for i in range(len(tuple1))
instead.
The full code will be
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install PythonExercises
You can use PythonExercises like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page