Foreground
Foreground
D0Z - motion / graphic / dev🧺

Brain πŸ”’

βœ•

brain

CAUTION

Some files are private or not ready yet, if a link gives you a 404 that's why :)
This is a work in progress, new notes will be added daily

List of note Indexes


                .... |\| .|||.    |\/|  .|\\. .|.
              .\\||/|.  .\|..||  .\|..|||...||.....
            .|   .....||.|\\\\\\    ... |\\\/. .\\. .||
        .\\|   .|\\|..|\\ .\\\\  .\\|. .\\\\\|  |\| |\\|
        |\\  |\\|..  /\\\. |\|\\   \\\\|.   .|\\. .\\\\|
        .\\. |\\\\\\\|.. .\\|      .\\||\\/|. |\\|     .|/\|
      \. .\\\||/\|....   \\| |\/   |\\\  |\\\| .\\|  \\| ....
    |\/  |\\| |\\\\\\\| |\|.\\\   \\\\. |\\\\| |\\  \\.  ||..
      ..|||\|  .. .\\\\. |\\\\\\  .\\|....|\\\. |\\\\\\  |/. |/
    \\\|..   .\\\ |\\. .\\\| \\|   |||\\\.  ...|\\/||.  .\\\
  |\|  |\/.  /\\\\\| .\\\\. \\.   .../|.   .|\\\|.   |\\\|  |\\
    .  |||\\|.  ..||| .\\|.  |\|  \\|..../\\| |\\|  .\\\\\   ..
    \\|  .||\|.|..      |\\\|./\  \\||\. ||...    .\\\\/.  |\/||
    ..|/||.   |\\\\\|.     .|/\|  ||.        .||\\\     .|||. |\
  .\/|  \\\. .|\\\|||\\\||..       .|\\\\\\\|\\\\.  /\\\\||. |
    .|| |\\\\|  .......|\\\\\\.  .\\\. ..|||....  .\\\\|.. ...
    \\||....|\\\\\\\\||\\\\\\\/   |\|....|||\\\\\\\/....|\\\|
      ||.|\||\\| .....|\\\\..\\|    .|\\\. ||........ .|\|...
          . |\  /\\/\\\\\\. |\.  .\\\\\\.  ./\\\\/  |\\\||.
        .|\.|\| .|\|... ..              ./\\|..|\\|  ..
            .|\\|  .\\\\.\\\\\\\   \||...\\\|..|\\\|.||
                |\. ..||....||     ... ..||\\\. .|.
                        ...            .......

↑ Python


Python - Input And Printing

  • input(): Read an user input
  • print(): Print to the console

Example:

# Read an input
name = input("Enter your name: ")

# Display data
print("Hello", name)

Printing instruction

[!TIP] It's recommended to use a f-string, see Python String

Can be used in multiple manners:

  • print("hello world")
  • print("hello", <variable containing a string>)
  • print("hello" + <variable containing a string>)
  • print("hello %s" % <variable containing a string>)

You can use ' or " or """ to define a string

  • ': one word
  • ": one line
  • """: a paragraphe or more

Example:

print('hello')

Output:

hello

Example:

print("""Hello, World !

I Love Python.""")

Output:

Hello, World !

I Love Python.

Printing variables

  • %s -> String
  • %d -> Integer
  • %f -> Float
  • %o -> Octal
  • %x -> Hexadecimal
  • %e -> Exponential

They can be used to perform conversions directly inside the print function.

Example:

print("Integer = %d" % 18)
print("Float = %f" % 18)
print("Octal = %o" % 18)
print("Hexa = %x" % 18)
print("Expo = %e" % 18)

Output:

Integer = 18
Float = 18.000000
Octal = 22
Hexa = 12
Expo = 1.800000e+01

When using multiple variables you use parenthesis

Example :

print("Hello %s %s" % (string1, string2))

Output:

Hello World !

Escape %

You can use another %

Example:

print("I want to print %%d not %s" % 'here')

Output:

I want to print %d not here

Repeat a string

print('_A' * 10)

Line break

using \n

print "Jan\nFΓ©v\nMar\nAvr\nMai\nJuin\nJuil\nAoΓ»t"

Tabulation

using \t

print("""
Routine:
\t- Eat
\t- Sleep\n\t- Repeat
""")

# Outputs

Routine:
  - Eat
  - Sleep
  - Repeat

In some context this works too

print("""
Routine:
  - Eat
  - Sleep
  - Repeat
""")

# Outputs

Routine:
  - Eat
  - Sleep
  - Repeat
Β© 2024 d0z.eu | 0.1.0-beta.39