• Cabinet
    • Member's benefits

      • Create study meterials
      • Subscribe for quizzes
      • Practice in Flashcards mode
      • Practice in Quiz mode
      • Track your progress and identify weak spots
      • Add explanations
      • Discuss topics with others
      • Create and join study groups
      • Have fun and connect with friends!

      Sign In

      Sign in Register
  • Discover
    • Study materials
    • Study groups
  • Announcements
  • Practice
    • Please sign in to practice

One-line class declaration: >>> class MyClass(object): >>> spam = "I am spam"

class MyClass = ((object,), {"spam": "I am spam"})

MyClass = type("MyClass", (object,), {"spam": "I am spam"})

MyClass = class("MyClass", (object,), ["spam": "I am spam"})

  • 0 explanations
  • 0 requizzes

Replace RED space

2::

::2

:2

:2:

  • 0 explanations
  • 0 requizzes

>>> d = {'four': {'six': 6, 'five': 5}, 'three': [3, 33, 333], 'two': 2, 'one': 1} Print out to console only first level of dictionary like this: >>> {'four': {...}, 'one': 1, 'three': [...], 'two': 2}

print(d)

from pprint import pprint pprint(d, depth=1)

from pprint import pprint pprint(d)

  • 0 explanations
  • 0 requizzes

>>> x = 10 >>> 10 == x > 7

True

False

  • 0 explanations
  • 0 requizzes

>>> x = 5 >>> x < 10 < x*10 < 100

True

False

  • 0 explanations
  • 0 requizzes

>>> x = 60 >>> 1 < x < 100

True

False

  • 0 explanations
  • 0 requizzes

Inline if statement: if x: y=100 else: y=20

if x: y=100 else y=20

x=20 if x else 100

y=100 if x else 20

  • 0 explanations
  • 0 requizzes
  • 1

Python tricks

Computer Science

  • Likes: 1
  • Subscribers: 6
  • Questions: 8 (+ 0)
  • ReQuiz count: 0
  • Created: April 24, 2014
  • By: Tarasics
  • Practiced by everyone: 5 times

Quiz settings


Quizzn is a service that bears only one goal - to make the learning process interactive, social, and easy. It is a free application that has the ability to connect people to learn and share knowledge.

More about us

Get In Touch

Feel like you need to contact us? Please write us a letter.

  • [email protected]

Help

Announcements
Get started

Mobile Support

Quizzn.com is mobile-optimized.

© 2015 Quizzn Inc. All rights reserved.

  • Home
  • Privacy policy
  • Terms of service
  • About