This document contains 8 programs written in Python. Program 1 reads and displays the content of a file with each word separated by "#". Program 2 reads a file and counts the number of vowels, consonants, uppercase, lowercase and other characters. Program 3 reads a file line by line and writes it to another file, excluding lines containing the letter "a". Program 4 creates a binary file to store student roll numbers and names, allows searching by roll number. Program 5 is similar but also stores marks and allows updating marks. Program 6 simulates rolling a dice using random numbers. Program 7 implements a stack using a list. Program 8 creates a CSV file to store user IDs and passwords, and allows searching by user ID.
COMPUTER SCIENCE CLASS 12 PRACTICAL FILEAnushka Rai
Here's my Computer Science Board Practical File. I hope you find it as useful as it was to me.This file is however of CBSE class 12th 2020-2021 syllabus.
COMPUTER SCIENCE CLASS 12 PRACTICAL FILEAnushka Rai
Here's my Computer Science Board Practical File. I hope you find it as useful as it was to me.This file is however of CBSE class 12th 2020-2021 syllabus.
Python is an interpreted, object-oriented programming language.
In this part, I have gone through some basics of python, game theory, and have created tic tac toe game
C# using Visual studio - Windows Form. If possible step-by-step inst.pdffazalenterprises
C# using Visual studio - Windows Form. If possible step-by-step instructions as well. You are to
create the classic game of Wheel of Fortune. Your application should consist of 3 players,
underlines to represent letters in the puzzle, and the available letters. The initial screen should
look something like: Wheel of Fortune Available letters
ABCDEFGHIKLMNOPQRSTUMWXYZ Puzzle Solve Player 3 Player 2 Player 1 50 Player 1
Spin or Solve Note: My puzzle is \"Pulp Fiction\" but pick your own puzzle\" Notice that Player
1 goes first (see note at bottom of screen) and can either spin or guess the puzzle by clicking the
appropriate button. If Player 1 spins, then the wheel will spin. To represent the wheel, create a
random number from 1 to 10. Each will represent a spot on the wheel. Here are the wheel values:
Random number 1: $100 Random number 2: S300 Random number 3: S500 Random number 4:
$700 Random number 5: S900 Random number 6 S2000 Random number 7: S3000 Random
number 8 S5000 Random number 9: -$1000 ll player loses S1000 from his/her total and loses
that turn Random number 10: S0 player only loses turn
Solution
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
textBox1.Text = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";
textBox17.Text = \"$0\";
textBox18.Text = \"$0\";
textBox19.Text = \"$0\";
}
private void Form1_Load(object sender, EventArgs e)
{
textBox1.Text = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";
textBox17.Text = \"$0\";
textBox18.Text = \"$0\";
textBox19.Text = \"$0\";
}
public void fun()
{
string s1 = \"\";
for (int i = 0; i < 26; i++)
{
s1 = s1 + globalvar.arr[i].ToString();
textBox1.Text = s1;
}
string s2 = textBox2.Text + textBox3.Text + textBox4.Text + textBox5.Text +
textBox6.Text + textBox7.Text + textBox8.Text;
s2 = s2 + textBox9.Text + textBox10.Text + textBox11.Text + textBox12.Text +
textBox13.Text + textBox14.Text + textBox15.Text + textBox16.Text;
if (s2.Equals(\"back to the future\"))
{
s = \"Player \" + (globalvar.k + 1) + \"won and score is \" +
globalvar.scores[globalvar.k];
second.Show();
}
}
Prompt p = new Prompt();
private void button1_Click(object sender, EventArgs e)
{
int[] rand = new int[10]{100,300,500,700,900,2000,3000,100,-1000,0};
Random r1 = new Random();
if (globalvar.k == 0)
{
int num = r1.Next(1, 11);
if (num < 9)
{
MessageBox.Show(\"Value is :$\", rand[num - 1].ToString());
p.Show();
char let = Prompt.c;
int cou=0;
if (let.Equals(\'b\'))
{
textBox2.Text=\"B\";
cou++;
}
else if (let.Equals(\'a\'))
{
textBox3.Text=\"A\";
cou++;
}
else if (let.Equals(\'c\'))
{
textBox4.Text=\"C\";
cou++;
}
else if (let.Equals(\'k\'))
{
textBox5.Text=\"K\";
cou++;
}
else if (let.Equals(\'t\'))
{
textBox6.Text=\"T\";
textBox8.Text=\"T\";
textBox13.Text=\"T\";
cou=cou+3;
}
else if (let.Equals(\'o\'))
{
te.
CBSE Class 12 Computer practical Python Programs and MYSQL Rishabh-Rawat
This upload is my Computer Science Practical File for CBSE class 12 Board exam practical.
Some errors in the displaying of the content might have crept in as I prepared this file on my android. ;P
Python is an interpreted, object-oriented programming language.
In this part, I have gone through some basics of python, game theory, and have created tic tac toe game
C# using Visual studio - Windows Form. If possible step-by-step inst.pdffazalenterprises
C# using Visual studio - Windows Form. If possible step-by-step instructions as well. You are to
create the classic game of Wheel of Fortune. Your application should consist of 3 players,
underlines to represent letters in the puzzle, and the available letters. The initial screen should
look something like: Wheel of Fortune Available letters
ABCDEFGHIKLMNOPQRSTUMWXYZ Puzzle Solve Player 3 Player 2 Player 1 50 Player 1
Spin or Solve Note: My puzzle is \"Pulp Fiction\" but pick your own puzzle\" Notice that Player
1 goes first (see note at bottom of screen) and can either spin or guess the puzzle by clicking the
appropriate button. If Player 1 spins, then the wheel will spin. To represent the wheel, create a
random number from 1 to 10. Each will represent a spot on the wheel. Here are the wheel values:
Random number 1: $100 Random number 2: S300 Random number 3: S500 Random number 4:
$700 Random number 5: S900 Random number 6 S2000 Random number 7: S3000 Random
number 8 S5000 Random number 9: -$1000 ll player loses S1000 from his/her total and loses
that turn Random number 10: S0 player only loses turn
Solution
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
textBox1.Text = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";
textBox17.Text = \"$0\";
textBox18.Text = \"$0\";
textBox19.Text = \"$0\";
}
private void Form1_Load(object sender, EventArgs e)
{
textBox1.Text = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";
textBox17.Text = \"$0\";
textBox18.Text = \"$0\";
textBox19.Text = \"$0\";
}
public void fun()
{
string s1 = \"\";
for (int i = 0; i < 26; i++)
{
s1 = s1 + globalvar.arr[i].ToString();
textBox1.Text = s1;
}
string s2 = textBox2.Text + textBox3.Text + textBox4.Text + textBox5.Text +
textBox6.Text + textBox7.Text + textBox8.Text;
s2 = s2 + textBox9.Text + textBox10.Text + textBox11.Text + textBox12.Text +
textBox13.Text + textBox14.Text + textBox15.Text + textBox16.Text;
if (s2.Equals(\"back to the future\"))
{
s = \"Player \" + (globalvar.k + 1) + \"won and score is \" +
globalvar.scores[globalvar.k];
second.Show();
}
}
Prompt p = new Prompt();
private void button1_Click(object sender, EventArgs e)
{
int[] rand = new int[10]{100,300,500,700,900,2000,3000,100,-1000,0};
Random r1 = new Random();
if (globalvar.k == 0)
{
int num = r1.Next(1, 11);
if (num < 9)
{
MessageBox.Show(\"Value is :$\", rand[num - 1].ToString());
p.Show();
char let = Prompt.c;
int cou=0;
if (let.Equals(\'b\'))
{
textBox2.Text=\"B\";
cou++;
}
else if (let.Equals(\'a\'))
{
textBox3.Text=\"A\";
cou++;
}
else if (let.Equals(\'c\'))
{
textBox4.Text=\"C\";
cou++;
}
else if (let.Equals(\'k\'))
{
textBox5.Text=\"K\";
cou++;
}
else if (let.Equals(\'t\'))
{
textBox6.Text=\"T\";
textBox8.Text=\"T\";
textBox13.Text=\"T\";
cou=cou+3;
}
else if (let.Equals(\'o\'))
{
te.
CBSE Class 12 Computer practical Python Programs and MYSQL Rishabh-Rawat
This upload is my Computer Science Practical File for CBSE class 12 Board exam practical.
Some errors in the displaying of the content might have crept in as I prepared this file on my android. ;P
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
Chapter 3 - Islamic Banking Products and Services.pptx
Practical File Grade 12.pdf
1. GRADE : XII
COMPUTER SCIENCE
PRACTICAL FILE
Index
No. Practical Name Date Signature
1 Program to read and display file content line by
line with eachword separated by “ #”
2 Program to read the content of file and display the total
numberof consonants, uppercase, vowels and lower
case characters.
3 Program to read the content of file line by line
and write it toanother file except for the lines
contains „a‟ letter in it.
4 Program to create binary file to store Rollno and
Name, Searchany Rollno and display name if
Rollno found otherwise “Rollno not found”
5 Program to create binary file to store Rollno,
Name and Marksand update marks of entered
Rollno.
6 Program to generate random number 1-6, simulating a
dice.
7 Program to implement Stack in Python using List.
8 Create a CSV file by entering user-id and password, read and
search the password for given user- id.
2. Program 1: Program to read and display file content line by line with each
word separated by “ #”
#Program to read content of file line by
line#and display each word separated by
'#'
f = open("file1.txt")
for line in f:
words =
line.split()
for w in
words:
print(w+'#',end='')
print()
f.close()
NOTE : if the original content of file is:
India is my
countryI love
python
Python learning is fun
OUTPUT
India#is#my#country#
I#love#python#
Python#learning#is#fun
#
3. Program 2: Program to read the content of file and display the total numberof consonants,
uppercase, vowels and lower case characters.
#Program to read content of file
#and display total number of vowels, consonants, lowercase and uppercase characters
f = open("file1.txt")
v=0
c=0
u=0
l=0
o=0
data = f.read()
vowels=['a','e','i','o','u']
for ch in data:
if ch.isalpha():
if ch.lower() in vowels:
v+=1
else:
c+=1
if ch.isupper():
u+=1
elif ch.islower():
l+=1
elif ch!=' ' and ch!='n':
o+=1
print("Total Vowels in file :",v)
print("Total Consonants in file n :",c)
print("Total Capital letters in file :",u)
print("Total Small letters in file :",l)
print("Total Other than letters :",o)
f.close()
NOTE : if the original content of file is:
India is my countryI
love python
Python learning is fun123@
OUTPUT
Total Vowels in file : 16
Total Consonants in file n : 30
Total Capital letters in
file
: 2
Total Small letters in file : 44
Total Other than letters : 4
4. Program 3: Program to read the content of file line by line and write it toanother
file except for the lines contains „a‟ letter in it.
#Program to read line from file and write it to another line
#Except for those line which contains letter 'a'
f1 = open("file2.txt")
f2 = open("file2copy.txt","w")
for line in f1:
if 'a' not in line:
f2.write(line)
print(“## File Copied Successfully! ##”)
f1.close()
f2.close()
NOTE: Content of file2.txt
a quick brown fox
one two three four
five six seven
India is my
countryeight nine
ten
bye!
OUTPUT
## File Copied Successfully! ##
NOTE: After copy content of file2copy.txt
one two three four
five six seven
eight nine ten
bye!
5. Program 4: Program to create binary file to store Rollno and Name, Searchany Rollno
and display name if Rollno found otherwise “Rollno not found”
#Program to create a binary file to store Rollno and name#Search
for Rollno and display record if found #otherwise "Roll no. not
found"
import pickle
student=[]
f=open('student.dat','wb')
ans='y'
while ans.lower()=='y':
roll = int(input("Enter Roll Number :"))name
= input("Enter Name :")
student.append([roll,name]) ans=input("Add
More ?(Y)")
pickle.dump(student,f)
f.close()
f=open('student.dat','rb')
student=[]
while True:
try:
student = pickle.load(f)
except EOFError:
break
ans='y'
while ans.lower()=='y':
found=False
r = int(input("Enter Roll number to search :"))for s
in student:
if s[0]==r:
print("## Name is :",s[1], " ##")
found=True
break
if not found:
print("####Sorry! Roll number not found ####")
ans=input("Search more ?(Y) :")
f.close()
6. OUTPUT
Enter Roll Number
:1Enter Name :Amit
Add More ?(Y)y
Enter Roll Number
:2Enter Name :Jasbir
Add More ?(Y)y
Enter Roll Number
:3Enter Name :Vikral
Add More ?(Y)n
Enter Roll number to search
:2## Name is : Jasbir ##
Search more ?(Y) :y
Enter Roll number to search
:1## Name is : Amit ##
Search more ?(Y) :y
Enter Roll number to search :4
####Sorry! Roll number not found ####
Search more ?(Y) :n
Program 5: Program to create binary file to store Rollno,Name and Marksand update
marks of entered Rollno.
#Program to create a binary file to store Rollno and name#Search
for Rollno and display record if found #otherwise "Roll no. not
found"
import pickle
student=[]
f=open('student.dat','wb')
ans='y'
while ans.lower()=='y':
roll = int(input("Enter Roll Number :"))name
= input("Enter Name :")
marks = int(input("Enter Marks :"))
student.append([roll,name,marks])
ans=input("Add More ?(Y)")
pickle.dump(student,f) f.close()
f=open('student.dat','rb+')
student=[]
while True:
try:
student = pickle.load(f)
except EOFError:
7. break
ans='y'
while ans.lower()=='y':
found=False
r = int(input("Enter Roll number to update :"))for s in
student:
if s[0]==r:
print("## Name is :",s[1], " ##")
print("## Current Marks is :",s[2]," ##")m =
int(input("Enter new marks :")) s[2]=m
print("## Record Updated ##")
found=True
break
if not found:
print("####Sorry! Roll number not found ####")ans=input("Update more ?(Y)
:")
f.close()
OUTPUT
Enter Roll Number
:1Enter Name :Amit
Enter Marks :99
Add More ?(Y)y
Enter Roll Number
:2Enter Name
:Vikrant Enter
Marks :88
Add More ?(Y)y
Enter Roll Number
:3Enter Name :Nitin
Enter Marks :66
Add More ?(Y)n
Enter Roll number to update
:2## Name is : Vikrant ##
## Current Marks is : 88 ##
Enter new marks :90
## Record Updated ##
Update more ?(Y) :y
Enter Roll number to update
:2## Name is : Vikrant ##
## Current Marks is : 90 ##
Enter new marks :95
## Record Updated ##
Update more ?(Y) :n
8. Program 6: Program to generate random number 1-6, simulating a dice.
# Program to generate random number between 1 - 6# To
simulate the dice
import randomimport
time
print("Press CTRL+C to stop the dice ")
play='y'
while play=='y':
try:
while True:
for i in range(10):
print()
n = random.randint(1,6)
print(n,end='')
time.sleep(.00001)
except KeyboardInterrupt: print("Your
Number is :",n) ans=input("Play
More? (Y) :")
if ans.lower()!='y':
play='n'
break
OUTPUT
4Your Number is : 4
Play More? (Y) :y Your
Number is : 3Play More?
(Y) :y Your Number is : 2
Play More? (Y) :n
Program 7: Program to implement Stack in Python using List.
def isEmpty(S):
if len(S)==0:
return True
else:
return False
def Push(S,item):
S.append(item)
top=len(S)-1
def Pop(S):
if isEmpty(S):
return "Underflow"
else:
val = S.pop()if
9. len(S)==0:
top=None
else:
top=len(S)-1
return val
def Peek(S):
if isEmpty(S):
return "Underflow"
else:
top=len(S)-1
return S[top]
def Show(S):
if isEmpty(S):
print("Sorry No items in Stack ")
else:
t = len(S)-1
print("(Top)",end=' ')
while(t>=0):
print(S[t],"<==",end=' ')t-
=1
print()
# main
begins hereS=[] #Stack
top=None
while True:
print("**** STACK DEMONSTRATION ******")
print("1. PUSH ")
print("2. POP")
print("3. PEEK")
print("4. SHOW STACK ")
print("0. EXIT")
ch = int(input("Enter your choice :"))if
ch==1:
val = int(input("Enter Item to Push :"))
Push(S,val)
elif ch==2:
val = Pop(S)
if val=="Underflow":
print("Stack is Empty")
else:
elif ch==3:
print("nDeleted Item was :",val)
val = Peek(S)
if val=="Underflow":
print("Stack Empty")
else:
10. elif ch==4:
print("Top Item :",val)
Show(S)
elif ch==0:
print("Bye")
break
OUTPUT
**** STACK DEMONSTRATION ******
1. PUSH
2. POP
3. PEEK
4. SHOW STACK
0. EXIT
Enter your choice :1
Enter Item to Push :10
**** STACK DEMONSTRATION ******
1. PUSH
2. POP
3. PEEK
4. SHOW STACK
0. EXIT
Enter your choice :1
Enter Item to Push :20
**** STACK DEMONSTRATION ******
1. PUSH
2. POP
3. PEEK
4. SHOW STACK
0. EXIT
Enter your choice :1
Enter Item to Push :30
**** STACK DEMONSTRATION ******
1. PUSH
2. POP
3. PEEK
4. SHOW STACK
0. EXIT
Enter your choice :4
(Top) 30 <== 20 <== 10 <==
**** STACK DEMONSTRATION ******
1. PUSH
2. POP
3. PEEK
11. 4. SHOW STACK
0. EXIT
Enter your choice :3Top
Item : 30
**** STACK DEMONSTRATION ******
1. PUSH
2. POP
3. PEEK
4. SHOW STACK
0. EXIT
Enter your choice :2 Deleted
Item was : 30
****STACKDEMONSTRATI*****
1. PUSH
2. POP
3. PEEK
4. SHOW STACK
0. EXIT
Enter your choice :4(Top) 20
<== 10 <==
**** STACK DEMONSTRATION ******
1. PUSH
2. POP
3. PEEK
4. SHOW STACK
0. EXIT
Enter your choice :0
Bye
Program 8: Create a CSV file by entering user-id and password, read and search the password for
given user- id.
import csv
with open("7.csv", "w") as obj:
fileobj = csv.writer(obj)
fileobj.writerow(["User Id", "password"])
while(True):
user_id = input("enter id: ")
password = input("enter password: ")
record = [user_id, password]
fileobj.writerow(record)
x = input("press Y/y to continue and N/n to terminate the programn")
12. if x in "Nn":
break
elif x in "Yy":
continue
with open("7.csv", "r") as obj2:
fileobj2 = csv.reader(obj2)
given = input("enter the user id to be searchedn")
for i in fileobj2:
next(fileobj2)
# print(i,given)
if i[0] == given:
print(i[1])
break