Posts

Showing posts with the label CS

Python Programming| Class 11th Revision | Short Notes with example

Image
  #COMMAND Use of: if, elif, else, for, in, range #COMMAND Use of: while (loop) #COMMAND Use of: str (string) #COMMAND Use of: def (defining a function)

Python Code for Tic Tac Toe game | Between two Players | Computer Science

Here is the code for TIC TAC TOE game between two playersss.... import os import time board = [' ',' ',' ',' ',' ',' ',' ',' ',' ',' ']     player = 1         ########win Flags##########     Win = 1     Draw = -1     Running = 0     Stop = 1     ###########################     Game = Running     Mark = 'X'         #This Function Draws Game Board     def DrawBoard():         print(" %c   %c   %c " % (board[1],board[2],board[3]))         print("__|__|__")              print(" %c   %c   %c " % (board[4],board[5],board[6]))         print("__|__|__")              print(" %c   %c   %c " % (board[7],board[8],board[9]))         print("__|__|__ ")         #This Function Checks position is empty or not     def CheckPosition(x):         if(board[x] == ' '):             return True         else:             return False         #This Function C

Python Codes | Codes to make calculater | Codes to make Tables | Code to find factorial of numbers | Computer Science | CS

 CODE 1: TO MAKE A CALCULATER IN PYTHON def add(x, y): return x+y def subtract(x, y): return x-y def multiply (x, y): return x*y def divide (x, y): return x/y print("select operation") print("1. Add") print("2. Subtract") print("3. Multiply") print("4. Divide") while True: choice=input("Enter choice (1/2/3/4):  ") if choice in ('1','2','3','4'): num1=float(input("enter first number:    ")) num2=float(input("enter second number:    ")) if choice  == '1': print(num1, "+", num2, "=", add(num1, num2)) elif choice == '2': print(num1, "-", num2,"=", subtract(num1, num2)) elif choice == '3': print(num1, "×", num2, "=", multiply(num1, num2)) elif choice == '4': print(num1, "÷", num2, "=", divide(num1, num2)) break else:

My SQL | Short Notes | Class 12 | CS | Computer Science

                MY SQL ____________________   #DATABASE To create database Create database xyz:   #USE COMMAND To use database Use xyz: #COMMAND TO DISPLAY EXISTING DATA •   Show databases: •   Show Tables:   # USE OF TABLE COMMAND To create table Create table abc(slno int, stdnm varchar(30), fathernm varchar(30), class char(3), sec char(1), marks int):   #USE OF DESC To describe the table desc abc:   #USE OF INSERT To insert value inside table insert into abc values(1, "aditya","alok","XI", "A",330):   insert into abc values(2,"abhay","aman","XII","B",410):   #USE OF   *  as ALL To show the full table Select* from abc:   #USE OF SELECT   To show any selected of coulmn Select stdnm, marks from abc:   #USE OF UPDATE To update any data in table update abc set marks=390 where slno=2:   #USE OF PRIMARY KEY To set a primary key c