Python Codes Basic to Advance
2.66K subscribers
82 photos
5 videos
8 files
100 links
Python Codes Basic to Advance

All Codes
@C_Codes_pro
@CPP_Codes_pro
@Java_Codes_Pro
@nodejs_codes_pro

Discussion
@bca_mca_btech
Download Telegram
# 15. str.isnumeric():
numeric_string = "12345"
is_numeric = numeric_string.isnumeric()
print(is_numeric)
# @python_codes_pro
╱╱┏╮
╱╱┃┃
▉━╯┗━╮
▉┈┈┈┈┃
▉╮┈┈┈┃
╱╰━━━╯
I hope you like it

Run any codes in group
@BCA_MCA_BTECH
👍2🥰2
# Triangle pattern 🔺️
n = 6
for i in range(n):
        print(" " * (n - 1 - i), end="")
        print("* " * (i + 1))

# @python_codes_pro
👍1
# Triangle : -
rows = 7

for i in range(1, rows + 1):
    for j in range(1, i + 1):
        print("*", end=" ")
    print()

for i in range(rows - 1, 0, -1):
    for j in range(1, i + 1):
        print("*", end=" ")
    print()

# @python_codes_pro
20 Questions on python loops:

1. What is a loop in Python?
2. What are the different types of loops in Python?
3. How do you create a for loop in Python?
4. How do you create a while loop in Python?
5. What is the range() function used for in a for loop?
6. How do you access the current iteration number in a for loop?
7. How do you exit a loop early in Python?
8. How do you skip an iteration in a loop?
9. How do you loop over a list in Python?
10. How do you loop over a dictionary in Python?
11. How do you loop over a tuple in Python?
12. How do you loop over a string in Python?
13. How do you loop over a set in Python?
14. How do you loop over a file in Python?
15. How do you loop over multiple lists in Python?
16. How do you loop over the index and value of a list in Python?
17. How do you create an infinite loop in Python?
18. How do you break out of nested loops in Python?
19. How do you use the continue statement in a loop?
20. How do you use the else statement in a loop?

@python_codes_pro
2👍2
Python Codes Basic to Advance pinned «Notes 📝 : Telegram.me/BCA_Sem1_Notes Telegram.me/BCA_Sem2_Notes Telegram.me/BCA_Sem3_Notes Telegram.me/BCA_Sem4_Notes Telegram.me/BCA_Sem5_Notes Telegram.me/BCA_Sem6_Notes Code practice Channels: Telegram.me/C_Codes_pro Telegram.me/CPP_Codes_pro Telegram…»
इस बाॅट में कोड रन करना सीखें
Learn how to run code in this bot.


See bot with Full tutorial: https://t.me/logicBots/147

लाभ (Advantage):
आप किसी को भी रियल टाइम में कोड का आउटपुट दिखा सकते हो, जिससे अगर आपके कोड में कोई गलती है तो वह भी सरलता से एक दूसरे से डिस्कस करके साॅल्व कर सकते हो।

See features written in pic ☝️☝️

You can show the output of the code to anyone in real time, so that if there is any mistake in your code, they can easily solve it by discussing with each other.

Full tutorial: https://t.me/logicBots/147
# Dimond pattern
rows = 5
for i in range(1, rows + 1):
    for j in range(1, rows - i + 1):
        print(end=" ")
    for j in range(1, 2 * i):
        print("*", end="")
    print()

for i in range(rows - 1, 0, -1):
    for j in range(1, rows - i + 1):
        print(end=" ")
    for j in range(1, 2 * i):
        print("*", end="")
    print()
# @python_Codes_pro
👍2
Learn in 55 seconds
How to run codes in telegram 👇
https://t.me/logicBots/163
import decrypto

choic = """
Enter your desier option...
1. Encrypt Your Text!
2. Decrypt Your Text!
Enter Only 1 or 2...
>> """
choose = input(choic) # Taking input from user

if choose == '1':
    txt = input("Enter Your Text: \n")
    encrypt = decrypto.MorseCodeCipher().encrypt(txt)
    print("\nYour Morse Code is 👇🏻\n", encrypt)
elif choose == '2':
    txt = input("Enter Your MorseCode: \n")
    decrypt = decrypto.MorseCodeCipher().decrypt(txt)
    print("\nYour Decrypted Text is 👇🏻\n", decrypt)
else:
    print("\nLol try again enter correct")
    exit(0)
import periodictable 
Atomic_no=int(27) #taking input
Element=periodictable.elements[Atomic_no]
print(f"Atomic number {Element.number}\n Symbol {Element.symbol} \n Name {Element.name} \n Atomic mass {Element.mass} \n Density {Element.density}\n Isotpes ")
1
# Print Pascal's triangle like pattern
n = int(input("Enter a number: "))
print("\n".join([" "*(n-i) + "".join([str(abs(j)) for j in range(-i, i+1)]) for i in range(n+1)]))

"""
0
101 Pattern
21012
"""
👍1
# The Zen of Python

import this
😁1
# fetch details of any ip address
# Example ip: 192.1.2.1
import urllib.request
import json
ip = input("Please enter IP address: ")
url = f"http://ip-api.com/json/{ip}"
req = urllib.request.urlopen(url)
res_body = req.read()
res = json.loads(res_body.decode("utf-8"))

print(f"""
Status : {res["status"]}
Country : {res['country']}
Countrycode : {res["countryCode"]}
Region : {res["region"]}
City : {res['city']}
Zip Code : {res["zip"]}
latitude : {res['lat']}
longitude : {res['lon']}
timezone : {res["timezone"]}
ISP : {res["isp"]} """)
3👍1
string = "I am a python developer"
X=string.split()
se = (X[::-1])
print(" ".join(se))

# Reverse string in python
2
import random
import pyautogui
import time
x = ["hi", "hello", "spam", "python", "how are u?", "I love you"]

while True:
pyautogui.typewrite(random.choice(x))
time.sleep(1)
pyautogui.press("enter")


# Random spam using python
# note work only in pc.
2
Ab aap log apna khud ka Compiler bot bana sakte hain easily 🥳🥳🔥
Apne manpasand name aur username se

Create your own
By using @CloneCompiler_bot

See full details: Click Here
Extract App details using python !

#python
import requests
from bs4 import BeautifulSoup
i=input("enter app name")
page = requests.get(f"https://play.google.com/store/search?q={i}&c=apps")
soup = BeautifulSoup(page.content, "html.parser")

Details = soup.find("div", "omXQ6c").text.strip()
Ratings = soup.find("div", "TT9eCd").text.strip()
Reviews = soup.find("div", "g1rdde").text.strip()
print(f"Details: {Details}\nRatings: {Ratings}\nReviews: {Reviews}")

Img = soup.find("div", "Jeh37")
images = Img.find_all("img", {"itemprop": "image"})
print(images[0]['src'])
1
sᴇᴀʀᴄʜ ɢɪᴛʜᴜʙ ʀᴇᴘᴏsɪᴛᴏʀʏ ᴜsɪɴɢ ᴘʏᴛʜᴏɴ.

----------------------------------------
from github import Github
token="Enter Github Token Here"
g = Github(token)

X=g.search_repositories(input("Enter Repo Name to Search from Github  "))

y=X[0]
print(f"""Full Name : {y.full_name}
Size :{round(y.size/1024,2)} mb
Created at {y.created_at}
Visibility:  {y.visibility}  
Language: {y.language}
Description : {y.description}
Topics: {" ".join(y.topics)}
Total forks :{y.forks}
Total Stars :{y.stargazers_count}
Source Link: {y.html_url}
Last Update: {y.updated_at}
By @Mr_Sukkun """)

--------------------------
1