30, ఆగస్టు 2025, శనివారం
27, ఆగస్టు 2025, బుధవారం
mr
Python Variables
Variables
Variables are containers for storing data values.
Creating Variables
Python has no command for declaring a variable.
A variable is created the moment you first assign a value to it.
x = 5
y = "John"
print(x)
print(y)Variables do not need to be declared with any particular type, and can even change type after they have been set.
Example
x = 4 # x is of type int
x = "Sally" # x is now of type str
print(x)Casting
If you want to specify the data type of a variable, this can be done with casting.
Example
x = str(3) # x will be '3'
y = int(3) # y will be 3
z = float(3) # z will be 3.0Get the Type
You can get the data type of a variable with the type() function.
Example
x = 5
y = "John"
print(type(x))
print(type(y))Single or Double Quotes?
String variables can be declared either by using single or double quotes:
Example
x = "John"
# is the same as
x = 'John'Case-Sensitive
Variable names are case-sensitive.
Example
This will create two variables:
a = 4
A = "Sally"
#A will not overwrite a26, ఆగస్టు 2025, మంగళవారం
python lamba expressions ..............
A lambda function is a small anonymous function.
A lambda function can take any number of arguments, but can only have one expression.
Syntax
lambda arguments : expressionThe expression is executed and the result is returned:
Add 10 to argument a, and return the result:
x = lambda a : a + 10
print(x(5))Lambda functions can take any number of arguments:
Example
Multiply argument a with argument b and return the result:
x = lambda a, b : a * b
print(x(5, 6))Example
Summarize argument a, b, and c and return the result:
x = lambda a, b, c : a + b + c
print(x(5, 6, 2)).................................The power of lambda is better shown when you use them as an anonymous function inside another function.
Say you have a function definition that takes one argument, and that argument will be multiplied with an unknown number:
def myfunc(n):
return lambda a : a * nUse that function definition to make a function that always doubles the number you send in:
Example
def myfunc(n):
return lambda a : a * n
mydoubler = myfunc(2)
print(mydoubler(11))Or, use the same function definition to make a function that always triples the number you send in:
Example
def myfunc(n):
return lambda a : a * n
mytripler = myfunc(3)
print(mytripler(11))Or, use the same function definition to make both functions, in the same program:
Example
def myfunc(n):
return lambda a : a * n
mydoubler = myfunc(2)
mytripler = myfunc(3)
print(mydoubler(11))
print(mytripler(11))Use lambda functions when an anonymous function is required for a short period of time.
python intl/regnl languages..................# A lambda function to add 10 to a number add_ten = lambda x: x + 10 print(add_ten(5)) # Output: 15 # Using lambda with filter() to get even numbers my_list = [1, 2, 3, 4, 5, 6] even_numbers = list(filter(lambda x: x % 2 == 0, my_list)) print(even_numbers) # Output: [2, 4, 6]
23, ఆగస్టు 2025, శనివారం
Python Online Compiler................... programiz.proStrings in Python are sequences of characters, so we can access individual characters using indexing. Strings are indexed starting from 0 and -1 from end. This allows us to retrieve specific characters from the string. s = "ramdayinaboyina " # Accesses 3rd character: 'r' print(s[-10]) # Accesses 5th character from end: '' print(s[-5])
print("Try programiz.pro")
a=3
b=3.4
print(a,b)
print(type(a))
a=b
print(a)
a=int(b)
print(a)
c = "ramu.a.dayinaboyina"
print(c)
s = "ram.a.dayinaboyina"
print(s[1]) # access 2nd char
s1 = s + s[0] # update
print(s1) # print
output:-
Try programiz.pro
3 3.4
<class 'int'>
3.4
3
ramu.a.dayinaboyina
a
ram.a.dayinaboyinaa
s = """I am Learning
Python String on by ramu sir """
print(s)
s = '''I'm a
ramu'''
print(s)
22, ఆగస్టు 2025, శుక్రవారం
lab session 5 for python programming ....................
n = 6 # Initialize the factorial variable to 1 fact = 1 # Calculate the factorial using a for loop for i in range(1, n + 1): fact *= i print(fact)
import math
# Lambda function to calculate square root using math.sqrt()
sqrt_lambda_math = lambda x: math.sqrt(x)
# Example usage
number = 25
result = sqrt_lambda_math(number)
print(f"The square root of {number} using math.sqrt() is: {result}")program 3
# using lambda with max() function
find_max = lambda a, b, c: max(a, b, c)
result = find_max(10, 5, 8)
print("Maximum Number :", result)
prg4 for filter , lambda concepts
a = [1, 2, 3, 4, 5]
res = list(filter(lambda num: num % 2 == 0, a))
print(res)
output
[2, 4]
21, ఆగస్టు 2025, గురువారం
17, ఆగస్టు 2025, ఆదివారం
8, ఆగస్టు 2025, శుక్రవారం
cyber security.............
Volume-based attacks, also known as volumetric attacks, are a type of DDoS attack that flood a target with massive amounts of network traffic, overwhelming its resources and causing service disruptions. These attacks are typically measured in bits per second (bps), packets per second (pps), or connections per second (cps). The goal is to saturate the target's bandwidth and processing power, making it unable to handle legitimate traffic
Application-based attacks exploit vulnerabilities in software applications to gain unauthorized access, disrupt functionality, or steal data. These attacks can target various layers of an application, including the web, API, and mobile application layers. Common types include injection attacks, cross-site scripting (XSS), cross-site request forgery (CSRF), and denial-of-service (DoS/DDoS) attacks.
A URL interpretation attack, also known as a semantic URL attack, occurs when an attacker manipulates the parameters of a URL to exploit vulnerabilities in how a web application interprets the URL's syntax and semantics. This can lead to unauthorized access to resources, modification of data, or other unexpected behavior
A dictionary attack is a type of cyberattack where hackers try to guess passwords by systematically trying words from a pre-defined list (a "dictionary") of common passwords. This method exploits the fact that many people use predictable or easily guessed passwords. Attackers use automated tools to rapidly input these potential passwords until they find a match, gaining unauthorized access to systems or data
Protocol-based attacks are a type of DDoS (Distributed Denial of Service) attack that exploits weaknesses in network protocols, particularly at Layers 3 and 4 of the OSI model. These attacks aim to disrupt a service by overwhelming a target's resources with malicious connection requests or by exploiting protocol vulnerabilities to exhaust server capacity.
lab-4 python ..................
rows = int(input("Enter number of rows: "))
for i in range(rows):
for j in range(i+1):
print(j+1, end=" ")
print()
// C++ implementation of the above approach
#include "bits/stdc++.h"
using namespace std;
// Function to return the word
// of the corresponding digit
void printValue(char digit)
{
// Switch block to check for each digit c
switch (digit) {
// For digit 0
case '0':
cout << "Zero ";
break;
// For digit 1
case '1':
cout << "One ";
break;
// For digit 2
case '2':
cout << "Two ";
break;
// For digit 3
case '3':
cout << "Three ";
break;
// For digit 4
case '4':
cout << "Four ";
break;
// For digit 5
case '5':
cout << "Five ";
break;
// For digit 6
case '6':
cout << "Six ";
break;
// For digit 7
case '7':
cout << "Seven ";
break;
// For digit 8
case '8':
cout << "Eight ";
break;
// For digit 9
case '9':
cout << "Nine ";
break;
}
}
// Function to iterate through every
// digit in the given number
void printWord(string N)
{
int i, length = N.length();
// Finding each digit of the number
for (i = 0; i < length; i++) {
// Print the digit in words
printValue(N[i]);
}
}
// Driver code
int main()
{
string N = "123";
printWord(N);
return 0;
}
Input: N = 1234
Output: One Two Three Four
Explanation:
Every digit of the given number has been converted into its corresponding word.
#
Python program to determine whether # the number is Armstrong number or not #
Function to calculate x raised to # the power y def power(x, y): if y == 0:
return 1 if y % 2 == 0: return power(x, y // 2) * power(x, y // 2) return x *
power(x, y // 2) * power(x, y // 2) # Function to calculate order of the number
def order(x): # Variable to store of the number n = 0 while (x != 0): n = n + 1
x = x // 10 return n # Function to check whether the given # number is
Armstrong number or not def isArmstrong(x): n = order(x) temp = x sum1 = 0
while (temp != 0): r = temp % 10 sum1 = sum1 + power(r, n) temp = temp // 10 #
If condition satisfies return (sum1 == x) # Driver code x = 153
print(isArmstrong(x)) x = 1253 print(isArmstrong(x))
# Multiplication
table (from 1 to 10) in Python
num = 12
# To take input
from the user
# num =
int(input("Display multiplication table of? "))
# Iterate 10
times from i = 1 to 10
for i in range(1,
11):
print(num, 'x', i, '=', num*i)
Input: N = 567
Output: Five Six Seven
7, ఆగస్టు 2025, గురువారం
6, ఆగస్టు 2025, బుధవారం
ONE DOCTORATE SAID TO RAMU HE USES CHATGPT FOR EVERY TOPIC ...............RAMU ASKED HIM HOW MUCH U PAID TO BUY YOUR DOCTORATE .......my brother with degree is getting 24 lakhs salary per Anam In my department my colleague doctorate is getting 8 lakhs only Anam Big laugh by ramu………….. musth joke ah ah creaming............................................................
One doctorate said to ramu "he uses ChatGPT for every topic"
Ramu asked him how much u paid to buy your doctorate
What a wonderful innocent doctorate I meat I laughed loudly
The remain discussion read between the line
E=mc2 only for student, Scientist or phd.......... ramu quoted this stmt
and for u any change in the above eq.........................
my brother with degree is getting 24 lakhs salary per Anam
In my department my colleague doctorate is getting 8 lakhs
only
Big laugh by ramu…………..
musth joke ah ah Screaming.......................