CBSE COMPUTER SCIENCE
رفتن به کانال در Telegram
QUESTION BANK, REFERENCE BOOK, LAB MANUAL , WORKSHEET ETC., PYTHON TEXT BOOK AND REFERENCE BOOKS, 01. ASK QUESTIONS AT https://t.me/joinchat/FJ1noGs-64I0OWI1
نمایش بیشتر549
مشترکین
اطلاعاتی وجود ندارد24 ساعت
اطلاعاتی وجود ندارد7 روز
اطلاعاتی وجود ندارد30 روز
آرشیو پست ها
#Day,Dayofmonth,Dayname,Dayofweek,dayoftheyear
'''
Jan=Mar=May=Jul=Aug=Oct=Dec=31, Feb=28/29(Leap Year),Other Months=30 Days
#Jan=11,Feb=12,Mar=1,Apr=2,...,Dec=10 Not consider 0th Index
#Week1=Sunday,Week2=Monday,...,Week7=Saturday and
not consider '' it is in 0th index
'''
TotDays=[0,31,0,31,30,31,30,31,31,30,31,30,31]
M=[0,11,12,1,2,3,4,5,6,7,8,9,10]
WeekDay=['','SUNDAY','MONDAY','TUESDAY','WEDNESDAY','THURSDAY','FRIDAY','SATURDAY']
MonthName=['','JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC']
Day=int(input('Enter Day in +ve integer '))
Month=int(input('Enter Month in +ve integer '))
Year=int(input('Enter Year in +ve integer '))
if Year%4==0:
FebDays=29
else:
FebDays=28
TotDays[2]=FebDays
C=int(Year//100) #Century
Y=int(Year%100) #Year
X=M[Month] #Month Number like Jan=11,Feb=12,Mar=1 and so on
#print('C=',C,'Y=',Y,'M',M[Month])
#W=int((Day+(2.6*M[Month]-0.2)-2*C+Y+(Y/4)+(C/4))%7)
W=int((Day+Y+(Y/4)+(C/4)+(13*X/5)-2*C)%7) #Zeller's Rule
TotalDays=0
for i in range(1,Month):
TotalDays+=TotDays[i]
DayofYears=TotalDays+Day
print('DayofWeek',W+1)
print('DayName',WeekDay[W+1])
print('DayofMonth or Day',Day)
print('DayofYear / Total number of Days ',DayofYears)
print('MonthName',MonthName[Month])
List1- t.me/QuizBot?start=eowBkzeL
List2- t.me/QuizBot?start=k8DYZ3Oa
List3- t.me/QuizBot?start=Smn9ThxH
import mysql.connector as mcr
cn = mcr.connect(host='localhost',user='root',password='Admin')
#cn = mcr.connect(host='localhost',user='root',password='root',database='company')
cr = cn.cursor()
cr.execute('create database if not exists company')
cr.execute("use company")
cr.execute("create table if not exists employee(empno int, name varchar(20), dept varchar(20),salary int)")
print("Table Created Successfully...")
while True:
opt=int(input("1. ADD RECORD 2. UPDATE RECORD 3.DELETE RECORD 4. SEARCH 5.DISPLAY 6.EXIT : "))
if opt==1: #INSERTING A RECORD
e = int(input("Enter Employee Number :"))
n = input("Enter Name :")
d = input("Enter Department :")
s = int(input("Enter Salary :"))
query="insert into employee values({},'{}','{}',{})".format(e,n,d,s)
#qry="insert into employee values(%s,'%s','%s',%s)"%(e,n,d,s)
cr.execute(query)
cn.commit()
print("A RECORD INSERTED...")
elif opt==2: #UPDATING A RECORD
e=int(input("Enter employee number to be updated "))
s=int(input("Enter salary to be updated "))
query="update employee set salary={} where empno={}".format(s,e)
cr.execute(query)
print("A Record Updated ")
cn.commit()
elif opt==3: #DELETING A RECORD
e=int(input("Enter employee number to be deleted"))
query="delete from employee where empno={}".format(e)
cr.execute(query)
print("Record(s) Deleted ")
cn.commit()
elif opt==4: #SEARCHING A RECORD
e=int(input("Enter employee number to be searched"))
query="select * from employee where empno={}".format(e)
cr.execute(query)
result = cr.fetchall()
if cr.rowcount==0:
print("Record not found")
else:
print("EMPNO","NAME","DEPARTMENT","SALARY")
for row in result:
print(row[0],row[1],row[2],row[3])
cn.commit()
elif opt==5: #DISPLAYING RECORDS
query="select * from employee"
cr.execute(query)
result = cr.fetchall()
print("EMPNO","NAME","DEPARTMENT","SALARY")
for row in result:
print(row[0],row[1],row[2],row[3])
cn.commit()
elif opt==6: #CLOSING DATABASE
cn.commit()
cn.close()
print("File closed successfully...")
break
else:
print("Invalid OPtion...")
PROGRAMS ON PYTHON BASICS
1. Write a python program to add three numbers and print result
2. Write a python program to find average of 5 numbers
3. Write a python program to read marks in 6 subject and calculate total and percentage
4. Write a Python program to convert all units of time into seconds.
5. Write a Python program to get an absolute file path.
6. Write a Python program to convert seconds to day, hour, minutes and seconds. Write a python program to convert temperature from Fahrenheit to Celsius
7. Write a python program to convert temperature from Celsius to Fahrenheit
8. Write a program to calculate Simple interest
9. Write a program to calculate area of Rectangle
10. Write a program to calculate area of Square
11. Write a program to calculate area of Circle
12. Write a program to calculate Perimeter of Rectangle
13. Write a Program to print ASCII Value of a character
14. Write a Python program to print the following string in a specific format
15. Write a Python program to display the current date and time. Sample Output : Current date and time : 2014-07-05 14:34:14
16. Write a Python program which accepts the user's first and last name and print them in reverse order with a space between them.
17. Write a Python program which accepts a sequence of comma-separated numbers from user and generate a list and a tuple with those numbers. Sample data : '30', ‘1’,' 15', ' 22', ' 53'
18. Write a Python program to display the first and last colors from the following list. color_list = ["Red","Green","White" ,"Black"]
19. Write a Python program that accepts an integer (n) and computes the value of n+nn+nnn. Sample value of n is 5 Expected Result : 615
20. Write a Python program to print the documents (syntax, description etc.) of Python built-in function(s). Sample function : abs() Expected Result : abs(number) -> number Return the absolute value of the argument.
21. Write a Python program to get the volume of a sphere with radius 6.
22. Write a Python program to get the difference between a given number and 17, if the number is greater than 17 return double the absolute difference.
23. Write a Python program to test whether a number is within 100 of 1000 or 2000.
24. Write a Python program to count the given number in a given list.
25. Write a Python program to get the n (non-negative integer) copies of the first 3 characters of a given string. Return the n copies of the whole string if the length is less than 2.
26. Write a Python program to test whether a passed letter is a vowel or not.
27. 25. Write a Python program to check whether a specified value is contained in a group of values. Test Data : 3 -> [1, 5, 8, 3] : True -1 -> [1, 5, 8, 3] : False
28. Write a Python program that will accept the base and height of a triangle and compute the area.
29. Write a Python program to compute the greatest common divisor (GCD) of two positive integers.
30. Write a Python program to get the least common multiple (LCM) of two positive integers.
31. Write a Python program to sum of three given integers. However, if two values are equal sum will be zero.
32. Write a Python program to sum of two given integers. However, if the sum is between 15 to 20 it will return 20.
33. Write a Python program that will return true if the two given integer values are equal or their sum or difference is 5.
34. Write a Python program to add two objects if both objects are an integer type.
35. Write a Python program to display your details like name, age, address in three different lines.
36. Write a Python program to solve (x + y) * (x + y). Test Data : x = 4, y = 3
Expected Output : (4 + 3) ^ 2) = 49
37. Write a Python program to convert height (in feet and inches) to centimeters.
38. Write a Python program to convert the distance (in feet) to inches, yards, and miles.
39. Write a Python program to calculate body mass index.
28. Write a Python program that will accept the base and height of a triangle and compute the area. 29. Write a Python program to compute the greatest common divisor (GCD) of two positive integers. 30. Write a Python program to get the least common multiple (LCM) of two positive integers. 31. Write a Python program to sum of three given integers. However, if two values are equal sum will be zero. 32. Write a Python program to sum of two given integers. However, if the sum is between 15 to 20 it will return 20. 33. Write a Python program that will return true if the two given integer values are equal or their sum or difference is 5. 34. Write a Python program to add two objects if both objects are an integer type. 35. Write a Python program to display your details like name, age, address in three different lines. 36. Write a Python program to solve (x + y) * (x + y). Test Data : x = 4, y = 3 Expected Output : (4 + 3) ^ 2) = 49 37. Write a Python program to convert height (in feet and inches) to centimeters.
38. Write a Python program to convert the distance (in feet) to inches, yards, and miles. 39. Write a Python program to calculate body mass index.
PROGRAMS ON PYTHON BASICS
1. Write a python program to add three numbers and print result
2. Write a python program to find average of 5 numbers
3. Write a python program to read marks in 6 subject and calculate total and percentage 4. Write a Python program to convert all units of time into seconds. 5. Write a Python program to get an absolute file path.
6. Write a Python program to convert seconds to day, hour, minutes and seconds. Write a python program to convert temperature from Fahrenheit to Celsius
7. Write a python program to convert temperature from Celsius to Fahrenheit
8. Write a program to calculate Simple interest
9. Write a program to calculate area of Rectangle
10. Write a program to calculate area of Square
11. Write a program to calculate area of Circle
12. Write a program to calculate Perimeter of Rectangle
13. Write a Program to print ASCII Value of a character
14. Write a Python program to print the following string in a specific format (see the output). Sample String : "Our greatest fear should not be of failure, but of succeeding at something that doesn't really matter." Output : Our greatest fear should not be of failure, ******************************************* **************************but of succeeding at something that doesn't really matter. 15. Write a Python program to display the current date and time. Sample Output : Current date and time : 2014-07-05 14:34:14 16. Write a Python program which accepts the user's first and last name and print them in reverse order with a space between them. 17. Write a Python program which accepts a sequence of comma-separated numbers from user and generate a list and a tuple with those numbers. Sample data : '30', ‘1’,' 15', ' 22', ' 53' Output : List : ['30', 1,' 15', ' 22', ' 53'] Tuple : ('30', 1,' 15', ' 22', ' 53') 18. Write a Python program to display the first and last colors from the following list. color_list = ["Red","Green","White" ,"Black"] 19. Write a Python program that accepts an integer (n) and computes the value of n+nn+nnn. Sample value of n is 5
Expected Result : 615 20. 11. Write a Python program to print the documents (syntax, description etc.) of Python built-in function(s). Sample function : abs() Expected Result : abs(number) -> number Return the absolute value of the argument. 21. Write a Python program to get the volume of a sphere with radius 6. 22. Write a Python program to get the difference between a given number and 17, if the number is greater than 17 return double the absolute difference. 23. Write a Python program to test whether a number is within 100 of 1000 or 2000. 24. Write a Python program to count the given number in a given list. 25. Write a Python program to get the n (non-negative integer) copies of the first 3 characters of a given string. Return the n copies of the whole string if the length is less than 2. 26. Write a Python program to test whether a passed letter is a vowel or not. 27. 25. Write a Python program to check whether a specified value is contained in a group of values. Test Data : 3 -> [1, 5, 8, 3] : True -1 -> [1, 5, 8, 3] : False
LISTS
1. Give the output of the following code:-
list=['p','r','o','b','l','e','m']
list[1:3]=[]
print(list)
list[2:5]=[]
print(list)
2. Give the output of the following code:-
l1=[13,18,11,16,13,18,13]
print(l1.index(18))
print(l1.count(18))
l1.append(l1.count(13))
print(l1)
3. WAP in python to create a list of natural numbers from 1 to 50 using for loop.
4. WAP in python to take two lists of same size and create a third list of same size with adding elements at the same location of 1st & 2nd list. E.g. if A=[1,2,3], B= [4,5,6], then C[5,7,9].
5. WAP in Python to accept any ten numbers from the user in a list and display the maximum number along with its position.
6. WAP in Python to calculate &display the factorial of all elements of an integer list.
7. WAP to remove all even numbers from the given list.
8. WAP the print second largest element of the given list.
9. WAP to display cumulative elements of a given list.
For eg LIST is [10,20,30,40]
Output should be [10, 30,60,100]
10. Predict the output of the following code in python:
T1[0]=2
print(T1)
11. Write the output for the following:
x = [4, 7, 9, 12, 10]
count = 0
for i in x:
count= count + 1
print("Total number of elements = ", count)
12. Write the output for the following:
A = [6, 2, 7, 9, 1, 3]
Sum = 0
Avg = 0
for x in range(len(A)):
Sum += A[x];
Avg = Sum//len(A);
print("Sum = ",Sum)
print("Average = ", Avg)
13. Write the output for the following:
x = []
N = eval(input("enter size of list : "))
for i in range(0, N):
x.append(eval(input("enter "+ str(i) + " element : ")))
print("Numbers in the list are ")
print(x)
max1 = x[0]
for i in range(1, N):
if ( x[i] > max1):
max1 = x[i]
print("Maximum value in the list = ", max1)
*********
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [17-08-2023 PM 11:35]
11-informatics practices - study material
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [17-08-2023 PM 11:35]
https://drive.google.com/file/d/1rul7ldq0OChII8Q7jiW7qNQv3NIE1RyM/view
S SHUNMUGA SUNDARAM, M.E, A.M.I.E, MISTE,. IAENGG, [17-08-2023 PM 11:35]
11 computer science - study material https://drive.google.com/file/d/1rtkdkowRALnS4Dk6tGh5hcJKgv9zqMfn/view
