Python programming codes
43 subscribers
25 photos
1 video
83 files
82 links
Uploading All programming codes are updating Daily
ask doubts in comment box 🎁☑️
Download Telegram
Learn for free in 2023:

1. HTML
html.com

2. CSS
css-tricks.com

3. JavaScript
javascript.info

3. Git & GitHub
git-scm.com

6. React
react-tutorial.app

7. APIs
rapidapi.com

8. SQL
sqlbolt.com
HTTP STATUS CODES
Information [100 - 199]

100 - Continue
101 - Switching Protocols
102 - Processing
103 - Early Hints

Success [200-299]

200 - Ok
201 - Created
202 - Accepted
204 - No Content
206 - Partial Content

Redirect [300-399]

300 - Multiple Choices
301 - Moved Permanently
304 - Not Modified
307 - Temporary Redirect
308 - Permanant Redirect

Client Error [ 400-499]

400- Bad Request 401 - Unauthorized
403 - Forbidden
404 - Not Found
409 - Conflict

Server Error [500 - 599]

500 - Internal Server Error
501 - Not Implemented
504 - Bad Gateway
507 - Service Unavailable
508 - Gateway Timeout
Top 100 Product Based Companies in India.pdf
408.8 KB
Document from Itsmekriish
On dividing a number by 56, we get 29 as remainder. On dividing the same number by 8, what will be the remainder ?

4 5 6 7
Anonymous Quiz
0%
4
33%
5
33%
6
33%
7
Which one of the following is the common factor of (4743 + 4343) and (4747 + 4347) ?
Anonymous Quiz
0%
(47 - 43)
50%
(47 + 43)
50%
(4743 + 4343)
0%
None of these
Which one of the following can't be the square of natural number ?
Anonymous Quiz
33%
32761
0%
81225
33%
42437
0%
20164
33%
None of these
What are local variables and global variables in Python?
Entry
Global Variables: Variables declared outside a function or in a global space are called global variables. These variables can be accessed by any function in the program.

Local Variables: Any variable declared inside a function is known as a local variable. This variable is present in the local space and not in the global space.
When to use a tuple vs list vs dictionary in Python?
Entry
Use a tuple to store a sequence of items that will not change.

Use a list to store a sequence of items that may change.

Use a dictionary when you want to associate pairs of two items.
Explain some benefits of Python
Entry
Python is a dynamic-typed language. It means that you don’t need to mention the data type of variables during their declaration.

Python supports object-orientated programming as you can define classes along with the composition and inheritance.

Functions in Python are like first-class objects. It suggests you can assign them to variables, return from other methods and pass them as arguments.

Developing using Python is quick but running it is often slower than compiled languages.

Python has several usages like web-based applications, test automation, data modeling, big data analytics, and much more.
What is Lambda Functions in Python?
Junior
A Lambda Function is a small anonymous function. A lambda function can take any number of arguments, but can only have one expression.

Consider:

x = lambda a : a + 10
print(x(5)) # Output: 15
How do I modify a string in python?
Junior
You can’t because strings are immutable in python. In most situations, you should simply construct a new string from the various parts you want to assemble it from. Work with them as lists; turn them into strings only when needed.

>>> s = list("Hello zorld")
>>> s
['H', 'e', 'l', 'l', 'o', ' ', 'z', 'o', 'r', 'l', 'd']
>>> s[6] = 'W'
>>> s
['H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd']
>>> "".join(s)
'Hello World'
What is a Negative Index in Python?
Junior
Negative numbers mean that you count from the right instead of the left. So, list[-1] refers to the last element, list[-2] is the second-last, and so on.
How the string does get converted to a number?
Junior
To convert the string into a number the built-in functions are used like int() a constructor. It is a data type that is used like int (‘1’) == 1.

float() is also used to show the number in the format as float(‘1’) = 1.

The number by default are interpreted as a decimal and if it is represented by int(‘0x1’) then it gives an error as ValueError. In this the int(string,base) the function takes the parameter to convert string to number in this the process will be like int(‘0x1’,16) == 16. If the base parameter is defined as 0 then it is indicated by octal and 0x indicates it as a hexadecimal number.

There is function eval() that can be used to convert a string into number but it is a bit slower and present many security risks #python
#printing numbers right triangle shape in column wise
num = int(input("number of rows: "))

for row in range(num):
val = row + 1
dec = num - 1
for col in range(row+1):
print(format(val,"<4"),end=" ")
val = val + dec
dec = dec - 1
print()
#Reverse floyd's Triangle
n = int(input("nunber of rows: "))
k = 0
for i in range(n):
k = k + i
m = n + k
for i in range(n):
for j in range(i+1):
print(m,end=" ")
m = m - 1
print()
num = int(input("enter the number of rows: "))
k = 0
for i in range(num):
m = num + k
for j in range(i+1):
print(m,end=" ")
m = m-1
print()
#right angle triangle shape
num = int(input("enter the number of rows: "))
for i in range(num):
for j in range(i+1):
print(format("*","<4"),end=" ")
print()