Posts

Showing posts with the label Arguments in Python

Featured Post

SQL Interview Success: Unlocking the Top 5 Frequently Asked Queries

Image
 Here are the five top commonly asked SQL queries in the interviews. These you can expect in Data Analyst, or, Data Engineer interviews. Top SQL Queries for Interviews 01. Joins The commonly asked question pertains to providing two tables, determining the number of rows that will return on various join types, and the resultant. Table1 -------- id ---- 1 1 2 3 Table2 -------- id ---- 1 3 1 NULL Output ------- Inner join --------------- 5 rows will return The result will be: =============== 1  1 1   1 1   1 1    1 3    3 02. Substring and Concat Here, we need to write an SQL query to make the upper case of the first letter and the small case of the remaining letter. Table1 ------ ename ===== raJu venKat kRIshna Solution: ========== SELECT CONCAT(UPPER(SUBSTRING(name, 1, 1)), LOWER(SUBSTRING(name, 2))) AS capitalized_name FROM Table1; 03. Case statement SQL Query ========= SELECT Code1, Code2,      CASE         WHEN Code1 = 'A' AND Code2 = 'AA' THEN "A" | "A

How to Use Arguments in Real Python Programs

Image
Here are four types of exclusive arguments in python. The arguments are passers to functions. These are Required arguments, Keyword arguments, Default arguments and Variable-length arguments. Here're 4 Important Arguments in Python The arguments supply input to functions . Because these are various types, herein you will know the details and usage of those types. Argument#1: Required arguments Positional arguments are known as  required arguments  and are passed to a function in the correct order. The arguments in the function call should match the number in the function definition. Sample program: def cal(a,b):     """program to calculate sum of 2 numbers"""     sum=a+b     return sum a=int(input("enter 1st number")) b=int(input("enter 2nd number")) print(cal(a,b)) Output enter 1st number 10 enter 2nd number 22 32 ** Process exited - Return Code: 0 ** Press Enter to exit terminal Argument#2: Keyword arguments A default argument is