Image

Python / Code (page 2)

BEGINNER

C 0009 - Lambda
Copy this code (do not copy and paste!). Be careful with the indentation!

x = lambda a, b, c, d, e: a + b + c + d + e
print(x(5, 6, 2, 16, 24))
C 00010 - Scope
Copy this code (do not copy and paste!). Be careful with the indentation!

x = 1200
def myfunc():
  x = 600
  print(x)
myfunc()
print(x)
C 0011 - Try Except
Copy this code (do not copy and paste!). Be careful with the indentation!

import datetime
x = datetime.datetime.now()
print(x.year)
print(x.strftime("%m/%d/%Y, %H:%M:%S"))
C 0012 - Date and time
Copy this code (do not copy and paste!). Be careful with the indentation!

x = 24
y = 680
print("X") if x > y else print("Y")
C 0013 - If else
Copy this code (do not copy and paste!). Be careful with the indentation!

x = 24
y = 680
print("X") if x > y else print("Y")
C 0014 - If else
Copy this code (do not copy and paste!). Be careful with the indentation!

x = 24
y = 680
print("X") if x < y else print("Y")
C 0015 - If else
Copy this code (do not copy and paste!). Be careful with the indentation!

x = 24
y = 680
z = 428
print("X") if x + y < z else print("X + Y")
C 0016 - Comparison operators
Copy this code (do not copy and paste!). Be careful with the indentation!

x = 27
y = 32
print(x <= y)
Image

CHOOSE YOUR COMPILER

Reproduce this code, choosing one of the compilers below (don't copy and paste! It would be too easy). They all have the same function, just choose one according to your preferences.

When copying your code, replace the existing (default) code already in the compiler with your own.

Warning! For some of these compilers, you must choose the programming language yourself from the menu that is then offered. Of course, don't forget to click on RUN!

Responsibility

Some of the external links presented below, are not under the direct responsibility of Fond of Code. We cannot therefore be held responsible for the quality/Viability, or the temporary nor permanent interruption of some of them.

All about Python

Code

Recent versions

Frameworks

Tools/Methodologies

Test

Info+

» Creation date: 1991
* Created by Guido van Rossum
* Developed by Python Software Foundation
* Influenced by Java
* Cross-platform
* Free license (Python Software Foundation License)

News

The comments you leave us are systematically subject to rigorous moderation. Incivility and slander, threats, intimidation of all kinds, more generally all gratuitous verbal violence, or the dissemination of unverified information... are not tolerated. We also reserve the right to publish only comments which effectively advance the debate and allow a better understanding of the subject covered by the article presented on this page (as well as all its ramifications) and this, whatever its overall content.

Image

Fond of Code TM © ®
All rights reserved - Protected Trademark/Logo (INPI)

Legal structures based in
Nice - FRANCE

Montreal - Canada
By appointment

SIRET: 41138921600028 (France)
Inc. : 661515-5 (Canada, Qc.)
Official resumption in France : March 2025
Beta version of the website : May 2024
Implementation : July 2024
Launch of initial activity : 1996 (Europe and North America)
New version of the website : April 2025

Fond of Code official launch : May 2025

Image
Image