• Skip to primary navigation
  • Skip to content
  • Skip to footer
Eliannys Cermeño
  • Home
  • Post
  • About
    Eliannys Cermeño

    Eliannys Cermeño

    Technical Analyst at Stratesys

    • Linkedin
    • GitHub
    • Youtube

    What are functions in Python?

    less than 1 minute read

    • A function is a block of code which only run when it is called.
    • A function can return data as a result.
    • To define a Python function, the def keyword is used.

    Example:

    def my_function():
        print("Hello!. I am a function!") 
    my_function()
    
    #Output:
    Hello!. I am a function!
    

    Reference

    Function

    Tags: Python question

    Updated: July 6, 2021

    Twitter Facebook LinkedIn
    Previous Next

    You May Also Enjoy

    How do you write comments in python?

    less than 1 minute read

    A single line comment can be added by using the hash (#)character. The hash (#) is added for every line that should be commented. Example: #This is a comme...

    How will you convert a string to all lowercase?

    less than 1 minute read

    To convert String to lowercase, you can use lower()v function on the String. String.lower() function returns a string with all the characters of thi...

    What means list [-1]?

    less than 1 minute read

    Suppose: list = [2, 33, 222, 14, 25] print(list[-1]) Options: A) Error B) None C) 25 D) 2 Answer: C) 25. The index -1 corresponds to the last index ...

    Which of the following is an invalid statement?

    less than 1 minute read

    A) numbers = 1,000,000 B) numbers = 1000 2000 3000 C) numbers = 1000, 2000, 3000 D) numbers = 1,000,000 Answer: B) numbers = 1000 2000 3000 Whitespace i...

    • Linkedin
    • GitHub
    • Youtube
    • Feed
    © 2022 Eliannys Cermeño. Powered by Jekyll & Minimal Mistakes.