What is runtime?
Runtime refers to the period when a program is actively running and performing operations.
What is compile time?
Compile time is the stage where Python checks your code and converts it into bytecode before executing it.
System language: o's and 1's (signals)
Python User Input:
Python allows for user input.
That means we are able to ask the user for input.
Example:Your name,age,gender collects the data and printed the screen.
name = input("Enter your name: ")
print("Hello,", name)
O/P:
Enter your name: Rohit
Hello, Rohit
Function overloading:
Same method name with difference number of parameters.
Ex; withdraw(pin);
withdraw(otp);
FUNCTION:
*Set of instructions with a name
*Function must have () & english verb forms.
*A function is a block of code which only runs when it is called.
*A function can return data as a result.
Ex: (),parameters(inputs)
Function names:
- A function name must start with a letter or underscore
- A function name can only contain letters, numbers, and underscores
- Function names are case-sensitive (myFunction and myfunction are different)
Creating a Function:
In Python, a function is defined using the def keyword, followed by a function name and parentheses().
def my_function():
print("Hello from a function")
Calling a Function:
To call a function, write its name followed by parentheses:
def walking():
print("Go to home")
walking()
O/P:
Go to home
We can call the same function multiple times:
walking()
walking()
walking()
Return Values:
Functions can send data back to the code that called them using the return statement.
Sometime function has no return values.
def get_greeting():
return "Hello from a function"
message = get_greeting()
print(message)
O/P:
Hello from a function
Top comments (2)
Thanks for your greetings.
Good Start!