background preloader

Python Cheat Sheet

Python Cheat Sheet
String String Methods Array Indexes and Slices a=[0,1,2,3,4,5] 6 len(a) 0 a[0] 5 a[5] 5 a[-1] 4 a[-2] [1,2,3,4,5] a[1:] [0,1,2,3,4] a[:5] [0,1,2,3] a[:-2] [1,2] a[1:3] [1,2,3,4] a[1:-1] Shallow copy of a b=a[:] Math Constants math.pi The mathematical constant π = 3.141592..., to available precision. math.e The mathematical constant e = 2.718281..., to available precision. Random Functions Sys Sys Variables argv Command line args builtin_module_names Linked C modules byteorder Native byte order check_-interval Signal check frequency exec_prefix Root directory executable Name of executable exitfunc Exit function name modules Loaded modules path Search path platform Current platform stdin, stdout, stderr File objects for I/O version_info Python version info winver Version number sys.argv foo.py sys.argv[0] bar sys.argv[1] -c sys.argv[2] qux sys.argv[3] --h sys.argv[4] os Variables Class Special Methods String Formatting Formatting Operations 'd' Signed integer decimal. Date Formatting Date Formatting Ad Related:  Algorithme

Création d'applications mobiles : 8 tutoriels vidéo pour les débutants ! - Geek Junior - Programmer une appli mobile ? Facile avec les tutos vidéo de Teen-Code ! Geek Junior te propose en partenariat avec Teen-Code de t’initier à la création d’applications mobiles (sous Android), avec une série de tutoriels que tu as retrouvés toutes les 2 semaines sur notre site jusqu’à Noël. Ca y est ! En attendant la prochaine qui démarrera début 2017, voici une synthèse de tout ce que tu auras appris une fois les 8 tutos faits et tes 8 applis créées. Tu auras fait un grand pas dans l’apprentissage de la programmation, sans même t’en rendre compte ! Tuto 1 Hello World : Comment créer une application dans App Inventor, comment la tester et comment l’installer sur son téléphone ou sur sa tabletteComment concevoir l’interface utilisateur de l’application, puis programmer son comportement dans l’interface BlocksComposants faire parler le téléphone, et lui faire faire des actions en le secouant Tuto 2 Graffiti : Tuto 3 Traqueur : Tuto 4 Zombie Mash : Tuto 5 Piano : Tuto 6 Maths Attack !

pyglet Installing Python on Windows First, download the latest version of Python 2.7 from the official Website. If you want to be sure you are installing a fully up-to-date version, click the Downloads > Windows link from the home page of the Python.org web site . The Windows version is provided as an MSI package. By design, Python installs to a directory with the version number embedded, e.g. Typing the full path name for a Python interpreter each time quickly gets tedious, so add the directories for your default Python version to the PATH. C:\Python27\;C:\Python27\Scripts\ You can do this easily by running the following in powershell: [Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27\;C:\Python27\Scripts\", "User") The second (Scripts) directory receives command files when certain packages are installed, so it is a very useful addition. Setuptools + Pip To obtain the latest version of Setuptools for Windows, run the Python script available here: ez_setup.py Virtual Environments

Hopscotch - Make your own game. Learn to code. Dolibarr - ERP CRM et Open Source - Portail France Beat Detection Algorithms - Math and Physics Disclaimer This document is to be distributed for free and without any modification from its original state. The author declines all responsibility in the damage this document or any of the things you will do with it might do to anyone or to anything. This document and any of its contents is not copyrighted and is free of all rights, you may thus use it, modify it or destroy it without breaking any international law. However according to the author's will, you may not use this document for commercial profit directly, but you may use indirectly its intellectual contents; in which case I would be pleased to receive a mail of notice or even thanks. This is my first tutorial and I am still a student, you must assume that this document is probably not free of small errors and bugs. Introduction Simulating a physical phenomena which obeys to known mathematical equations is, with a number of approximations, always feasable. I – Statistical streaming beat detection 1 – Simple sound energy

Python bad practice, a concrete case | Julien Danjou A lot of people read up on good Python practice, and there's plenty of information about that on the Internet. Many tips are included in the book I wrote this year, The Hacker's Guide to Python. Today I'd like to show a concrete case of code that I don't consider being the state of the art. In my last article where I talked about my new project Gnocchi, I wrote about how I tested, hacked and then ditched whisper out. Before I start, please don't get the spirit of this article wrong. The first thing that I noticed when trying to hack on whisper, is the lack of test. $ coverage run test_whisper.py........... While one would think that 61% is "not so bad", taking a quick peak at the actual test code shows that the tests are incomplete. When I tried to modify whisper, as the tests do not check the entire cycle of the values fed into the database, I ended up doing wrong changes but had the tests still pass. The code doesn't respect PEP 8 . That piece of code could be easily rewritten as:

Code - Tutorials for Beginners Create a 3D T-Rex Game Grades 2+ | Blocks Dance Party Minecraft Hour of Code Escape Estate Grades 2+ | Blocks, Python Code a 3D Space Invaders Game Minecraft Timecraft Rodocodo: Code Hour Pre-reader - Grade 5 | Blocks NASA's Space Jam Make a Flappy game Long Live Wakanda Grades 6+ | Blocks Hello World CodeMonkey Jr.: Pre-coding for Preschoolers Pre-reader | Blocks My Google Logo Grades 2-8 | Blocks Coding Town Grades 2-5 | JavaScript Mario's Secret Adventure: Build Your Own 3D Mario Game CodeCombat: Goblins 'n' Glory Grades 6-8 | JavaScript, Python Code Farm: Plant a Garden Blocks Jumper: Game Creation Make Shapes with Code Pre-reader - Grade 5 | JavaScript, Language independent (can be taught in multiple languages) AI for Oceans Grades 3+ | AI and Machine Learning The Grinch: Saving Christmas with Code Bot is sus?! Grades 2-8 | JavaScript | Internet Explorer 11, Microsoft Edge, Chrome, Firefox, Safari Code Club World: Make cool stuff with free coding games and activities Grades 2-5 | Blocks Dragon Blast Design your Hero

Cours SQL - Tutoriel SQL SQL (Structured Query Language) est un langage de programmation informatique destiné à stocker, à manipuler et à retrouver des données enregistrées dans des bases de données relationnelles. Le langage SQL est apparu pour la première fois en 1974, lorsqu’un groupe d’IBM a mis sur pied le premier prototype d’une base de données relationnelle. La première base de données relationnelle a été commercialisée par Relational Software (plus tard Oracle). SQL a des standards. Le site de ce didacticiel SQL dresse la liste des commandes SQL couramment utilisées, et se présente sous les sections suivantes : Commandes SQL: Instructions SQL de base pour stocker, retrouver et manipuler des données dans une base de données relationnelle.Manipulation de table: Manière dont les instructions SQL sont utilisées pour gérer des tables au sein de la base de données.SQL Avancé: Commandes de SQL avancé. La syntaxe de chaque commande SQL sera décrite et expliquée en premier lieu, puis illustrée par un exemple.

Related: