BaşlayınÜcretsiz Başlayın

Custom function syntax

As part of the IT support team, you frequently need to convert employee names into their company email addresses. The company follows a standard email format: first name (lowercase) + dot + last name (lowercase) + @techcompany.com. For example, "Jane Doe" becomes [email protected].

Instead of manually creating these emails repeatedly, you'll build a custom function to automate this task.

Bu egzersiz

Intermediate Python for Developers

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Define a function called generate_email that takes one argument called full_name.
  • Return the generated email from the function.
  • Call the function on the full_name string.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

full_name = "Alan Turing"

# Define the generate_email function
____ ____(full_name):
    name_parts = full_name.split()
    email = name_parts[0].lower() + '.' + name_parts[1].lower() + '@techcompany.com'
    
    # Return the email address
    ____ ____

# Call the function on the full_name string
print(____(____))
Kodu Düzenle ve Çalıştır