background preloader

Python

Python
Related:  Computer Science

Free Interactive Python Tutorial Popular Python recipes Welcome, guest | Sign In | My Account | Store | Cart ActiveState Code » Recipes Languages Tags Authors Sets NOTE: Recipes have moved! Popular Python recipes Tags: Recipe 1 to 20 of 4591 « Prev 1 2 3 ... 230 Next » View popular, latest, top-rated or most viewed Feed of the popular Python recipes Python Versions Top-rated recipes Python tags more… algorithms database debugging files graphics linux math mathematics network oop programs python shortcuts sysadmin text threads tkinter web windows xml Accounts Code Recipes Feedback & Information ActiveState Privacy Policy | Contact Us | Support © 2018 ActiveState Software Inc.

Online Python Tutor Write your Python code here: x = [1, 2, 3] y = [4, 5, 6] z = y y = x x = z x = [1, 2, 3] # a different [1, 2, 3] list! x.append(4) y.append(5) z = [1, 2, 3, 4, 5] # a different list! x.append(6) y.append(7) y = "hello" def foo(lst): lst.append("hello") bar(lst) def bar(myLst): print(myLst) foo(x) foo(z) [Optional] Please answer these questions to support our research and to help improve this tool. Options: Execute code using , , , , , and . Here are some example Python code snippets to visualize: Basic: hello | happy | intro | filter | tokenize | insertion sort Math: factorial | fibonacci | memoized fibonacci | square root | gcd | towers of hanoi User Input: raw input Objects: OOP 1 | OOP 2 | OOP 3 | inheritance Linked Lists: LL 1 | LL 2 | LL sum Pointer Aliasing:aliasing 1 | aliasing 2 | aliasing 3 | aliasing 4aliasing 5 | aliasing 6 | aliasing 7 | aliasing 8 | sumList Higher-Order Functions: closure 1 | closure 2 | closure 3 | closure 4 | closure 5list map | summation | lambda param | student torture

Fritzing Python Exercises Why Turing/Java/Python in grade 11? The choice of language for grade 11 is something I assume most schools take fairly seriously. I've been teaching 13 years and every year I review my choice of languages and ask myself if they are the best choices. I assume I'm not alone in this. Every language has Pros and Cons. Despite what you might think or hear around here I believe Turing is still a solid language in grade 11. I think most schools that teach Java in grade 11 do so because they want to use the same language for gr 11 and 12 so they can get past talking about syntax and focus on key concepts. I don't know of any other schools teaching Python in grade 11, but I wouldn't be shocked to find one. Please don't annoy/harass your teachers about their choice of programming languages, but a long as you approach them from a point of view of genuinely wanting to know why they teach language X, and have they considered language Y most teachers will be very honest with you.

Python game development Variables and Types - Learn Python - Free Interactive Python Tutorial Python is completely object oriented, and not "statically typed". You do not need to declare variables before using them, or declare their type. Every variable in Python is an object. This tutorial will go over a few basic types of variables. Numbers Python supports two types of numbers - integers and floating point numbers. To define an integer, use the following syntax: myint = 7 Execute Code To define a floating point number, you may use one of the following notations: myfloat = 7.0 myfloat = float(7) Strings Strings are defined either with a single quote or a double quotes. mystring = 'hello' mystring = "hello" The difference between the two is that using double quotes makes it easy to include apostrophes (whereas these would terminate the string if using single quotes) mystring = "Don't worry about apostrophes" There are additional variations on defining strings that make it easier to include things such as carriage returns, backslashes and Unicode characters. a, b = 3, 4 # This will not work!

Online Python exercises I've been thinking about online Python learners. There have been some cool examples of online code exercises, like Nathan's Javascript Lessons. These are great because they require absolutely no setup, and can run right on the web page that describes the concepts involved. But of course, it's easy to run Javascript in a browser. What are the options for doing something similar for Python? CodingBat provides exercises for Java and Python. Another server-side solution is the NCSS Challenge, which uses an elaborate sandboxing technique on the server to run arbitrary Python code. There are other server-side online Python execution pages: Server-side execution solve the problem of executing Python, but introduces the new problem of keeping the server safe. Try Python is an in-browser Python implementation using IronPython running in Silverlight. Reviewing all these possibilities, none are perfect, and some are far from it. Are there other possibilities?

Computational Thinking for Educators - Course 46 Simple Python Exercises This is version 0.45 of a collection of simple Python exercises constructed (but in many cases only found and collected) by Torbjörn Lager (torbjorn.lager@ling.gu.se). Most of them involve characters, words and phrases, rather than numbers, and are therefore suitable for students interested in language rather than math. Very simple exercises Higher order functions and list comprehensions Simple exercises including I/O Somewhat harder exercises A sentence splitter is a program capable of splitting a text into sentences.

Related: