Complete beginner's guide to Codesi Programming Language.
By the end of this week, you will:
- β Write and run basic Codesi programs
- β Understand variables and data types
- β Use operators and expressions
- β Write conditional statements
- β Create and use loops
- β Build simple functions
Time Required: 7 days, 1-2 hours per day
- Download Codesi
- Run your first program
likho("Namaste Duniya!")
likho("Welcome to Codesi!")
python codesi_production.pyTry these:
codesi:1> likho("Hello")
codesi:2> 2 + 2
codesi:3> "Rishaank" + " Gupta"
// This is a comment
// Comments help explain code
likho("This will run")
// likho("This won't run")
Create day1.cds:
// My First Codesi Program
// Author: [Your Name]
likho("Hello from Codesi!")
likho("I am learning programming")
likho("2 + 2 =", 2 + 2)
// Creating variables
naam = "Rishaank"
umra = 15
height = 5.8
is_student = sach
// Using variables
likho("Mera naam", naam, "hai")
likho("Main", umra, "saal ka hun")
// Numbers
age = 15 // Integer
price = 99.99 // Float
// Strings
naam = "Raj"
message = 'Hello'
// Booleans
is_adult = sach // True
is_minor = jhooth // False
// Null
value = khaali // None/Null
x = 10
likho(prakar(x)) // "Integer"
naam = "Raj"
likho(prakar(naam)) // "shabd"
Create day2_profile.cds:
// My Profile
naam = "[Your Name]"
umra = [Your Age]
city = "[Your City]"
hobby = "[Your Hobby]"
is_programmer = sach
likho("Profile Information")
likho("==================")
likho("Name:", naam)
likho("Age:", umra)
likho("City:", city)
likho("Hobby:", hobby)
likho("Programmer?", is_programmer)
a = 10
b = 3
likho("Addition:", a + b) // 13
likho("Subtraction:", a - b) // 7
likho("Multiplication:", a * b) // 30
likho("Division:", a / b) // 3.333...
likho("Modulo:", a % b) // 1
likho("Power:", a ** b) // 1000
x = 10
y = 20
likho(x == y) // jhooth
likho(x != y) // sach
likho(x < y) // sach
likho(x > y) // jhooth
likho(x <= 10) // sach
likho(y >= 20) // sach
age = 20
has_id = sach
// AND
agar ((age >= 18) aur (has_id == sach)) {
likho("Can enter")
}
// OR
is_student = jhooth
is_teacher = sach
agar (is_student ya is_teacher) {
likho("Educational discount available")
}
// NOT
is_blocked = jhooth
agar (nahi is_blocked) {
likho("Access granted")
}
Create day3_calculator.cds:
// Simple Calculator
a = 15
b = 4
likho("Calculator Results")
likho("================")
likho(a, "+", b, "=", a + b)
likho(a, "-", b, "=", a - b)
likho(a, "*", b, "=", a * b)
likho(a, "/", b, "=", a / b)
likho(a, "%", b, "=", a % b)
likho(a, "**", b, "=", a ** b)
age = 20
agar (age >= 18) {
likho("Adult")
}
marks = 55
agar (marks >= 40) {
likho("Pass")
} nahi_to {
likho("Fail")
}
marks = 85
agar (marks >= 90) {
likho("A+ Grade")
} ya_phir (marks >= 80) {
likho("A Grade")
} ya_phir (marks >= 70) {
likho("B Grade")
} ya_phir (marks >= 60) {
likho("C Grade")
} nahi_to {
likho("Fail")
}
Create day4_age_checker.cds:
// Age Group Checker
age = 25
agar (age < 0) {
likho("Invalid age")
} ya_phir (age < 13) {
likho("Child")
} ya_phir (age < 20) {
likho("Teenager")
} ya_phir (age < 60) {
likho("Adult")
} nahi_to {
likho("Senior Citizen")
}
// Basic for loop
har i se 1 tak 6 {
likho("Number:", i)
}
// With parentheses
har i ke liye (0 se 5 tak) {
likho(i)
}
count = 1
jabtak (count <= 5) {
likho("Count:", count)
count = count + 1
}
fruits = ["Apple", "Banana", "Orange"]
har fruit mein fruits {
likho("Fruit:", fruit)
}
// Break example
har i se 1 tak 11 {
agar (i == 5) {
break
}
likho(i)
}
// Continue example
har i se 1 tak 11 {
agar (i % 2 == 0) {
continue // Skip even numbers
}
likho(i) // Only odd numbers
}
Create day5_multiplication_table.cds:
// Multiplication Table
number = 7
likho("Multiplication Table of", number)
likho("========================")
har i se 1 tak 11 {
result = number * i
likho(number, "x", i, "=", result)
}
karya greet() {
likho("Hello, World!")
}
greet() // Call function
karya greet_person(naam) {
likho("Hello,", naam, "!")
}
greet_person("Rishaank")
greet_person("Priya")
karya add(a, b) {
vapas a + b
}
result = add(5, 3)
likho("Sum:", result)
// Use in expressions
total = add(10, 20) + add(5, 5)
likho("Total:", total) // 40
karya calculate_area(length, width) {
area = length * width
vapas area
}
room_area = calculate_area(10, 12)
likho("Room area:", room_area, "sq ft")
Create day6_functions_practice.cds:
// Function Practice
// 1. Function to check even/odd
karya is_even(num) {
vapas num % 2 == 0
}
// 2. Function to calculate square
karya square(x) {
vapas x * x
}
// 3. Function to find maximum
karya max_of_two(a, b) {
agar (a > b) {
vapas a
} nahi_to {
vapas b
}
}
// Test functions
likho("Is 10 even?", is_even(10))
likho("Square of 7:", square(7))
likho("Max of 15 and 23:", max_of_two(15, 23))
- Variables and data types
- Operators (arithmetic, comparison, logical)
- If-else statements
- Loops (for, while, foreach)
- Functions
Create week1_project_game.cds:
// Number Guessing Game - Week 1 Project
karya play_game() {
likho("==========================")
likho(" Number Guessing Game")
likho("==========================")
likho()
// Generate random target (1 to 50)
target = math_random(1, 50)
attempts = 0
max_attempts = 7
likho("Maine 1 se 50 ke beech ek number socha hai!")
likho("Aapko", max_attempts, "attempts hai.")
likho()
won = jhooth
jabtak (attempts < max_attempts) {
attempts = attempts + 1
likho("Attempt", attempts, "of", max_attempts)
guess = int_lo("Apna guess: ")
agar (guess == target) {
likho("π Correct! Aapne jeet liya!")
likho("Total attempts:", attempts)
won = sach
break
} ya_phir (guess < target) {
likho("β Too low! Try higher")
} nahi_to {
likho("β Too high! Try lower")
}
likho()
}
agar (nahi won) {
likho("π Game Over!")
likho("Sahi answer tha:", target)
}
}
// Start game
play_game()
// Ask to play again
likho()
again = input_lo("Phir se khelna hai? (yes/no): ")
agar (again == "yes") {
likho()
play_game()
}
likho("\nDhanyavaad for playing! π")
Complete these to master basics:
- Understand variables
- Know all data types
- Use operators correctly
- Write if-else statements
- Create loops
- Define functions
- Can write and run .cds files
- Can use REPL mode
- Can debug simple errors
- Can read and understand code
- Can write comments
- Profile display program
- Simple calculator
- Grade calculator
- Multiplication table
- Number guessing game
- Code for at least 30 minutes every day
- Type code yourself (don't copy-paste)
- Make mistakes and learn from them
// Try different values
x = 10
likho(x * 2) // What happens?
likho(x * 3) // How about this?
// Always explain your code
naam = "Raj" // Store user's name
// Test edge cases
karya divide(a, b) {
agar (b == 0) {
likho("Cannot divide by zero!")
vapas
}
vapas a / b
}
- What does this do?
- Why did this happen?
- How can I improve this?
// Convert Celsius to Fahrenheit
celsius = 25
fahrenheit = (celsius * 9 / 5) + 32
likho(celsius, "Β°C =", fahrenheit, "Β°F")
year = 2024
agar ((year % 4 == 0) aur ((year % 100 != 0) ya (year % 400 == 0))) {
likho(year, "is a leap year")
} nahi_to {
likho(year, "is not a leap year")
}
num = 17
is_prime = sach
agar (num <= 1) {
is_prime = jhooth
} nahi_to {
har i se 2 tak num {
agar (num % i == 0) {
is_prime = jhooth
break
}
}
}
agar (is_prime) {
likho(num, "is prime")
} nahi_to {
likho(num, "is not prime")
}
Before moving to Intermediate level, ensure you can:
β
Write programs with variables
β
Use all operators confidently
β
Create complex if-else chains
β
Use loops effectively
β
Define and call functions
β
Complete the Week 1 project
Congratulations on completing Week 1! π