🎯 Technology & Communication Training | 🎨 Website & Graphic Design | 💻 Technology Consulting | 🛠️ Installation & Repair Services by F4T SARL 🎯 Technology & Communication Training | 🎨 Website & Graphic Design | 💻 Technology Consulting | 🛠️ Installation & Repair Services by F4T SARL
🎯 تكوين في التكنولوجيا والاتصال | 🎨 تصميم المواقع والجرافيك | 💻 استشارات تكنولوجية | 🛠️ خدمات التركيب والإصلاح من طرف F4T SARL 🎯 تكوين في التكنولوجيا والاتصال | 🎨 تصميم المواقع والجرافيك | 💻 استشارات تكنولوجية | 🛠️ خدمات التركيب والإصلاح من طرف F4T SARL
Useful Python commands

Useful Python commands

Size
Price:

Read more

 

MegaTech- AZILAL


Useful Python commands:

  1. Print Statement:
    • Description: Used to display output on the console. It accepts one or more expressions as arguments and prints their values.
    • Example:

print("Hello, MEGATECH AZILAL!")

  1. Input Function:
    • Description: Used to take input from the user. It prompts the user with a message and waits for the user to enter some input, which is then returned as a string.
    • Example:

name = input("Enter F4T name: ")

  1. Conditional Statements (if, elif, else):
    • Description: Used to execute different blocks of code based on certain conditions. The if statement checks a condition, and if it's true, it executes a block of code. Optionally, elif and else can be used for additional conditions and fallbacks, respectively.
    • Example:

x = 10 if x > 0:

    print("x is positive")

elif x == 0:

    print("x is zero")

else:

    print("x is negative")

  1. Loops (for loop):
    • Description: Used to iterate over a sequence (such as a list or range) or other iterable objects. It executes a block of code repeatedly for each item in the sequence.
    • Example:

for i in range(5):

   print(i)

  1. Loops (while loop):
    • Description: Used to repeatedly execute a block of code as long as the condition is true. It continues execution until the condition becomes false.
    • Example:

x = 0 while x < 5:

    print(x) x += 1

  1. Functions:
    • Description: Used to group code into reusable blocks. Functions take inputs (arguments), perform some computation, and optionally return a result.
    • Example:

def greet(name):

   print("Hello,", name)

  1. Lists:
    • Description: Used to store multiple items in a single variable. Lists are ordered and mutable, meaning their elements can be changed.
    • Example:

my_list = [1, 2, 3, 4, 5]

  1. Tuples:
    • Description: Similar to lists but immutable, meaning their elements cannot be changed after creation. Tuples are often used to store related pieces of data together.
    • Example:

my_tuple = (1, 2, 3)

  1. Dictionaries:
    • Description: Used to store key-value pairs. Each key is unique and associated with a value. Dictionaries are unordered and mutable.(F4TSARLCOM)
Example:
my_dict = {"name": "F4T", "age": 3} 
  1. Sets:
    • Description: Used to store unique elements. Sets are unordered and mutable, and they don't allow duplicate values.
    • Example:

my_set = {1, 2, 3, 4, 5}

  1. List Comprehensions:
    • Description: Provides a concise way to create lists by applying an expression to each item in an iterable. It's often used as a more readable alternative to traditional loops.
    • Example:

squares = [x**2 for x in range(5)]

  1. Exception Handling (try, except):
    • Description: Used to handle errors gracefully. The try block contains the code that might raise an exception, and the except block catches and handles the exception if it occurs.
    • Example:

try:

     result = 10 / 0

except ZeroDivisionError:

     print("Error: Division by zero")

 F4T SARL

0 Reviews

Contact form

Name

Email *

Message *