0% found this document useful (0 votes)
9 views33 pages

Cs Project

The document discusses different types of functions in Python including functions with no arguments/return, functions with parameters but no return, functions with parameters and return, and functions with return. It also covers positional arguments, default arguments, keyword arguments, reading and writing to files, SQL commands to create and manipulate tables, SQL operators, and aggregate functions.

Uploaded by

rishumichael58
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views33 pages

Cs Project

The document discusses different types of functions in Python including functions with no arguments/return, functions with parameters but no return, functions with parameters and return, and functions with return. It also covers positional arguments, default arguments, keyword arguments, reading and writing to files, SQL commands to create and manipulate tables, SQL operators, and aggregate functions.

Uploaded by

rishumichael58
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

User defined functions:

# functions with no arguments and no return:-


For ex:

# output:

Page 1 of 33
# functions with parameters but no return value:-

Output:-

Page 2 of 33
# function with parameters and return:-

#output:

Page 3 of 33
# function with return:-

Page 4 of 33
o Write a program to enter a number and find the
area of the circle.

# output:

Page 5 of 33
Positional Arguments:

For example:

1.

Page 6 of 33
Page 7 of 33
Default Arguments:

For example:

Keyword arguments:
Page 8 of 33
For example:

Page 9 of 33
o Write a program to pass string to function and
count the number of vowels in it.

# output:

Page 10 of 33
o Write a program to count how many times any
character is present in a string?

# output:

Page 11 of 33
o Write a program to pass a list to function and
double the value.

# output:

Page 12 of 33
Reading from file:

# output:

Page 13 of 33
o Write a program to read lines using readlines().

# output:

Page 14 of 33
o Write a program to count the size of files in bytes
and number of lines.

Page 15 of 33
o Write a program using “w” mode.

# output:

# text changed:

Page 16 of 33
o Write a program to write in the notepad without
overwriting the previous text.

# output:

Page 17 of 33
o Write a program to find errors in text files.

# output:

Page 18 of 33
MY SQL
o WAP to create the given table in My Sql.

# code to create the table:-

Page 19 of 33
o WAP to display drinks and calories where calories
is greater than 130 from the table soft drinks .

#code:-

Page 20 of 33
o Write a SQL command for the following:

1. To create the table bank


2. Insert all the values in the table bank
3. Display the details of all
4. Display account number, customer name and
amount for those where amount is greater than
50000
5. Display the details of all where rate of interest is
NULL
6. Display all where name starts with ‘A’
7. Display all names where name ends with ‘r’
8. Display the records in descending order of
amount.

Page 21 of 33
1. To create the table bank:-

2. Insert all the values in the table bank:-

and so on………………
3. Display the details of all

Page 22 of 33
4. Display account number, customer name and
amount for those where amount is greater than
50000

5. Display the details of all where rate of interest is


NULL

Page 23 of 33
6. Display all where name starts with ‘A’

7. Display all names where name ends with ‘r’

8. Display the records in descending order of amount

Page 24 of 33
# program to add a column in an existing table :-

#program to remove a column from the table :-

#program to modify data in a table :-

# program to update using a formula or expression

Page 25 of 33
SQL Operators
● Arithmetic operator :-

Page 26 of 33
● Relational Operator :-

● Logical Operator :-

Page 27 of 33
● Special Operators :-

Page 28 of 33
Aggregate functions
# SUM()

# MIN()
# MAX()

Page 29 of 33
# COUNT()

# AVG()

# COUNT(*)

Page 30 of 33
Cartesian Product
● EQUI JOIN:-

# Inner join:-

Page 31 of 33
Page 32 of 33
Page 33 of 33

You might also like