Untitled

 avatar
unknown
python
a year ago
1.4 kB
5
Indexable

def add_numbers(x, y):
  """
  Adds two numbers and returns the result.
  """
  return x + y

def multiply_numbers(x, y):
  """
  Multiplies two numbers and returns the result.
  """
  return x * y

def concat_strings(x, y):
  """
  Concatenates two strings and returns the result.
  """
  return x + y

def is_even(x):
  """
  Checks if a number is even and returns True if it is, False otherwise.
  """
  return (x % 2 == 0)
  
def square_number(x):
  """
  Calculates the square of a number and returns the result.
  """
  return x ** 2

def string_length(x):
  """
  Calculates the length of a string and returns the result.
  """
  return len(x)

def max_of_three(x, y, z):
  """
  Finds the maximum of three numbers and returns the result.
  """
  if(x > y):
    temp =x 
    x = y
    y = temp
  if(y > z):
    temp =y
    y = z
    z = temp
  return z

def is_vowel(x):
  """
  Checks if a character is a vowel and returns True if it is, False otherwise.
  """
  if (x == 'a' or x == 'e' or x == 'i' or x == 'o' or x == 'u'):
    return True  
  if (x == 'A' or x == 'E' or x == 'I' or x == 'O' or x == 'U'):
    return True
  return False
  
def celsius_to_farenheit(x):
  """
  Converts a temperature in Celsius to Fahrenheit and returns the result.
  """
  return x * 9 / 5 +32

def is_positive(x):
  """
  Checks if a number is positive and returns True if it is, False otherwise.
  """
  if(x > 0):
    return True
  return False
    
Leave a Comment