Posts

Showing posts from March, 2026

CA 01 - Python Variables, Print

These task are done in jupyter lite and Idk how to submit so i copied them and pasted here TASK-1  print("hello world")  hello world name = "Adharsh" print(name)  Adharsh name = "Adharsh" age = 19 city = "chennai" print(name, age, city) Adharsh 19 chennai print(f"Hello, My name is {name} and I'm {age} years old living at {city}")  Hello, My name is Adharsh and I'm 19 years old living at chennai print("Hello" + " " + "world")   Hello world print("Line1\nLine2\nLine3") Line1 Line2 Line3 print('He said, "Hello, world!"')  He said, "Hello, world!" print("C:\\Users\\Name")  C:\Users\Name print(5+3)   8 print("hello","world",sep="-")   hello-world print("hello","world",sep=" ")  hello world is_active = True print(is_active)   True print("hello\nhello\nhello")   hello  hello  hello temperat...

CA 04 - Two Sum & Sorted Two Sum

Image
1. Two Sum Solved Easy Topics Companies Hint Given an array of integers  nums  and an integer  target , return  indices of the two numbers such that they add up to  target . You may assume that each input would have  exactly  one solution , and you may not use the  same  element twice. You can return the answer in any order.   Example 1: Input: nums = [2,7,11,15], target = 9 Output: [0,1] Explanation: Because nums[0] + nums[1] == 9, we return [0, 1]. Example 2: Input: nums = [3,2,4], target = 6 Output: [1,2] Example 3: Input: nums = [3,3], target = 6 Output: [0,1]   Constraints: 2 <= nums.length <= 10 4 -10 9 <= nums[i] <= 10 9 -10 9 <= target <= 10 9 Only one valid answer exists.   SOLUTION: class Solution :     def twoSum ( self , nums : List[ int ], target : int ) -> List[ int ]:         n= len (nums)         for i in range (n):    ...

CA 22 - Select Queries from DVD Rental database

 1. Retrieve film titles and their rental rates. Use column aliases to rename title as "Movie Title" and rental_rate as "Rate". select title as "Movie Title" , rental_rate as "Rate" from film; "As" is used in query to display the column aliases 2. List customer names and their email addresses. Alias first_name and last_name as "First Name" and "Last Name". select first_name as "First Name" , last_name as "Last Name" , email from customer; "As" is used in query to display the column aliases    3. Get a list of films sorted by rental rate in descending order. If two films have the same rental rate, sort them alphabetically by title. select title,rental_rate from film order by rental_rate desc ,title asc ; "Order by" used to display them in ascending and descending order 4. Retrieve actor names sorted by last name, then first name. select first_name,last_name from actor ord...