Answers for "Python def example"

58

python functions

def myFunction(say): #you can add variables to the function
  print(say)

myFunction("Hello")

age = input("How old are you?")

myFunction("You are {} years old!".format(age))

#this is what you get:

Hello
How old are you?
>>11 #lol my real age actually
You are 11 years old!
Posted by: Guest on February-18-2020
19

create function in python

def myFunction():
  print('I am running in a function!')
Posted by: Guest on November-19-2019
5

function in python

#A function is a block of code which only runs when it is called.
#You can pass data, known as parameters, into a function.
#following is a simple function
def exmple_of_function():
  print("Hello from a function")

example_of_function()
Posted by: Guest on June-30-2021
4

python function

def name():#name of the def(function);
  print("Hallo, World!")#Output is Hallo, World!;
  
name()#Name of the def, the programm will jump to the def;

#output:
#Hallo, World!
Posted by: Guest on February-03-2021
0

python function

# Defines Function
def my_function():
  print("Hello")
  print("Bye")

# Calls Function
my_function()
Posted by: Guest on February-23-2021
0

Python def example

def Hello
print("Hello")
Posted by: Guest on June-19-2021

Python Answers by Framework

Browse Popular Code Answers by Language