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
#forloop
#example - 5 : To display odd numbers from 0 to 25
for i in range(26):
if (i%2 != 0):
print(i)
#forloop
#example - 6 : To display odd numbers from 25 to 0 descending order

for i in range(25,0,-1):
print(i)
#nested_loop_example_1 :
""" To print all rows and columns equals with star pattren

i is row and j is column"""

#method_1
for i in range(1,6):
for j in range(1,6):
print("*",end=" ")
print()

print()

#method_2
for i in range(5):
print("* "*5)
#nested_loop_example_2 :
""" To print all rows and columns + 1 with star pattren

#Right half pyramid

i is row and j is column"""

#method_1
for i in range(0,6):
for j in range(i+1):
print("*",end=" ")
print()

print()

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

print()

#method_3
for i in range(6):
print("* "*(i+1))

print()

#method_4
def pattern(n):
k = 2 * n - 2
for i in range(0, n):
for j in range(0, k):
print(end="")
k = k - 2
for j in range(0, i + 1):
print("* ", end="")
print(" ")

pattern(6)

print()
#nested_loop_example_3 :
""" To print reverse all columns and rows - 1 with star pattren

i is row and j is column"""

#method_1


#method_2 (shortcut method)
for i in range(5):
print(" "*i,"* "*(5-i))
#nested_loop_example_4 :
""" To print left half pyramid with star pattren program

i is row and j is column"""

#method_1


#method_2 (shortcut method)
n = int(input("Enter the value: "))
for i in range(n):
print(" "*(n-(i+1)),"* "*(i+1))
everyone can respond my post any one reaction or comment of every post
admin of this channel @itsmekriish
Python programming codes pinned «everyone can respond my post any one reaction or comment of every post admin of this channel @itsmekriish»
#Create note book with python code
import tkinter as tk
from tkinter import filedialog

class Notepad(tk.Tk):
def init(self, *args, **kwargs):
tk.Tk.init(self, *args, **kwargs)

# Set the title for the notepad
self.title("Notepad")

# Create a text widget
self.text = tk.Text(self, wrap="word")
self.text.pack(side="top", fill="both", expand=True)

# Create a menu bar
self.menu = tk.Menu(self)
self.config(menu=self.menu)

# Create a file menu
file_menu = tk.Menu(self.menu)
self.menu.add_cascade(label="File", menu=file_menu)
file_menu.add_command(label="New", command=self.new_file)
file_menu.add_command(label="Open", command=self.open_file)
file_menu.add_command(label="Save", command=self.save_file)
file_menu.add_separator()
file_menu.add_command(label="Exit", command=self.quit)

# Create an edit menu
edit_menu = tk.Menu(self.menu)
self.menu.add_cascade(label="Edit", menu=edit_menu)
edit_menu.add_command(label="Cut", command=self.cut)
edit_menu.add_command(label="Copy", command=self.copy)
edit_menu.add_command(label="Paste", command=self.paste)

def new_file(self):
self.text.delete("1.0", "end")
self.title("Notepad")

def open_file(self):
file = filedialog.askopenfile(parent=self, mode="rb", title="Open a file")
if file:
contents = file.read()
self.text.delete("1.0", "end")
self.text.insert("1.0", contents)
file.close()
self.title(file.name + " - Notepad")

def save_file(self):
file = filedialog.asksaveasfile(mode="w", defaultextension=".txt", filetypes=[("Text Documents", "*.txt"), ("All Files", "*.*")])
if file:
contents = self.text.get("1.0", "end")
file.write(contents)
file.close()
self.title(file.name + " - Notepad")

def cut(self):
self.text.event_generate("<<Cut>>")

def copy(self):
self.text.event_generate("<<Copy>>")

def paste(self):
self.text.event_generate("<<Paste>>")

if name == "main":
notepad = Notepad()
notepad.mainloop()
how Many peoples active this channel
Anonymous Quiz
100%
active
0%
inactive
def myfunc(num):
if num%2==0:
return True else: return False print(myfunc(4))
Anonymous Quiz
29%
2
57%
True
0%
False
14%
Error
import math
print(abs(math.sqrt(25)))
Anonymous Quiz
50%
5
0%
25**25
25%
Error
25%
5.0
x=15
if x/2<2:
print(True) else: print(False)
Anonymous Quiz
50%
True
50%
False
Java script notes
Forwarded from SMW Services
JavaScript Notes.pdf
33.1 MB
Java script notes 2023