⚡️ سورس کد "سنگ ، کاغذ ، قیچی"
import random
print('سنگ ، کاغذ ، قیچی')
s = ['سنگ','کاغذ','قیچی']
z = random.choice(s)
o1 = 0
p2 = 0
dast = 0
for i in range(3):
x = str(input('enter1 >>> '))
#z = str(input('enter2 >>> '))
print('enter2 >>> ' + z)
if x == 'سنگ' and z == 'کاغذ':
print('player2 barande shod!')
p2 = p2 + 1
elif x == 'سنگ' and z == "قیچی" :
print('player1 barande shod!')
o1 = o1 + 1
elif x == 'کاغذ' and z == "قیچی" :
print('player2 barande shod!')
p2 = p2 + 1
elif x == 'کاغذ' and z == "سنگ" :
print('player1 barande shod!')
o1 = o1 + 1
elif x == 'قیچی' and z == "سنگ" :
print('player2 barande shod!')
p2 = p2 + 1
elif x == 'قیچی' and z == "کاغذ" :
print('player1 barande shod!')
o1 = o1 + 1
elif x == z:
print('mosavi!')
else:
print('dastor eshtebah ast !!!!')
dast = dast +1
print()
print(f'emtyaz player1: {o1}')
print(f'emtyaz player2: {p2}')
print(f' {dast} dast bazi shod!')
🤯2❤1👍1👎1😢1🐳1
چنل پایتون | جنگو | برنامه نویسی وب سایت | HTML & CSS & JS
Photo
خروجی این کد چیه؟
Media is too big
VIEW IN TELEGRAM
❤2🤔1🤯1😎1
پروژه ساخت برنامه گرافیکی تغییر تم👇👇
from tkinter import Tk, Label, Button, Entry, X
import tkinter
from tkinter import ttk
from tkinter import messagebox
class Root(Tk):
def __init__(self):
super().__init__()
for x in [ttk.Label, ttk.Button, ttk.Entry, ttk.Checkbutton, ttk.Radiobutton]:
x(self, text='Some ' + x.__name__).pack(fill=X)
pb = ttk.Progressbar(self, length=100)
pb.pack(fill=X)
pb.step(33)
ttk.Label(self, text='Select theme:').pack(pady=[50, 10])
self.style = ttk.Style()
self.combo = ttk.Combobox(self, values=self.style.theme_names())
self.combo.pack(pady=[0, 10])
button = ttk.Button(self, text='Apply')
button['command'] = self.change_theme
button.pack(pady=10)
def change_theme(self):
content = self.combo.get()
try:
self.style.theme_use(content)
except:
print("Failed to set theme " + content)
root = Root()
root.mainloop()
❤4
پست بعدی چی باشه؟؟😁
کامنت کنید ممنون😁❤️
کامنت کنید ممنون😁❤️
به درخواست دوست عزیزمون کد ماشین حساب گرافیکی قشنگی رو براتون اوردم☺️
from tkinter import *
def btnClick(numbers):
global operator
operator = operator + str(numbers)
text_input.set(operator)
def btnClearDisplay():
global operator
operator =""
text_input.set("")
def btnEqualsInput():
global operator
sumup = str(eval(operator))
text_input.set(sumup)
operator=""
cal = Tk()
cal.title("your C")
operator = ""
text_input = StringVar()
txtDisplay = Entry(cal, font=('arial', 20, 'bold'), textvariable=text_input, bd=30,
insertwidth=4, bg='powder blue', justify='left').grid(columnspan=4)
btn7 = Button(cal, padx=16, pady=16, bd=8, fg='black', font=('arial', 20, 'bold'),
text='7', command=lambda:btnClick(7) ).grid(row=1, column=0)
btn8 = Button(cal, padx=16, pady=16, bd=8, fg='black', font=('arial', 20, 'bold'),
text='8', command=lambda:btnClick(8)).grid(row=1, column=1)
btn9 = Button(cal, padx=16, pady=16, bd=8, fg='black', font=('arial', 20, 'bold'),
text='9', command=lambda:btnClick(9)).grid(row=1, column=2)
addition = Button(cal, padx=16, pady=16, bd=8, fg='black', font=('arial', 20, 'bold'),
text='+', command=lambda:btnClick('+')).grid(row=1, column=3)
btn4 = Button(cal, padx=16, pady=16, bd=8, fg='black', font=('arial', 20, 'bold'),
text='4', command=lambda:btnClick(4)).grid(row=2, column=0)
btn5 = Button(cal, padx=16, pady=16, bd=8, fg='black', font=('arial', 20, 'bold'),
text='5', command=lambda:btnClick(5)).grid(row=2, column=1)
btn6 = Button(cal, padx=16, pady=16, bd=8, fg='black', font=('arial', 20, 'bold'),
text='6', command=lambda:btnClick(6)).grid(row=2, column=2)
subtraction = Button(cal, padx=16, pady=16, bd=8, fg='black', font=('arial', 20, 'bold'),
text='-', command=lambda:btnClick('-')).grid(row=2, column=3)
btn1 = Button(cal, padx=16, pady=16, bd=8, fg='black', font=('arial', 20, 'bold'),
text='1', command=lambda:btnClick(1)).grid(row=3, column=0)
btn2 = Button(cal, padx=16, pady=16, bd=8, fg='black', font=('arial', 20, 'bold'),
text='2', command=lambda:btnClick(2)).grid(row=3, column=1)
btn3 = Button(cal, padx=16, pady=16, bd=8, fg='black', font=('arial', 20, 'bold'),
text='3', command=lambda:btnClick(3)).grid(row=3, column=2)
multiply = Button(cal, padx=16, pady=16, bd=8, fg='black', font=('arial', 20, 'bold'),
text='*', command=lambda:btnClick('*')).grid(row=3, column=3)
btn0 = Button(cal, padx=16, pady=16, bd=8, fg='black', font=('arial', 20, 'bold'),
text='0', command=lambda:btnClick(0)).grid(row=4, column=0)
btnClear = Button(cal, padx=16, pady=16, bd=8, fg='black', font=('arial', 20, 'bold'),
text='C', command= btnClearDisplay).grid(row=4, column=1)
btnEquals = Button(cal, padx=16, pady=16, bd=8, fg='black', font=('arial', 20, 'bold'),
text='=', command=btnEqualsInput).grid(row=4, column=2)
division = Button(cal, padx=16, pady=16, bd=8, fg='black', font=('arial', 20, 'bold'),
text='/', command=lambda:btnClick('/')).grid(row=4, column=3)
cal.mainloop()
❤4🔥2😁1
پست بعدی چی باشه؟؟😁
کامنت کنید ممنون🧐
کامنت کنید ممنون🧐
❤1
Happy programmer's day 🥳🥳
۲۲ شهریور روز برنامه نویس رو به تمامی برنامه نویس ها تبریک میگممم🥳🥳❤️
https://t.iss.one/programming_python_90
۲۲ شهریور روز برنامه نویس رو به تمامی برنامه نویس ها تبریک میگممم🥳🥳❤️
https://t.iss.one/programming_python_90
😍6❤1
ریکشن رو بترکونیدد😍
🔥5❤1