حالت آفلاین — محتوا از حافظهٔ کش نمایش داده می‌شود
همهٔ تمرین‌ها

تشخیص اسیدی یا بازی بودن ماده بر اساس پی‌اچ

تمرین آسان 736 visibility link download flag

برنامه‌ای بنویسید که مقدار pH یک ماده را دریافت کند و مشخص نماید که ماده اسیدی، بازی یا خنثی است. اگر pH کمتر از 7 باشد، خروجی "اسیدی" خواهد بود؛ اگر برابر 7 باشد، "خنثی" و اگر بیشتر از 7 باشد، "بازی".

پاسخ‌ها 10

def check_ph():
    ph = float(input("Enter pH value: "))
    if ph < 7:
        print("اسیدی")
    elif ph == 7:
        print("خنثی")
    else:
        print("بازی")

check_ph()
پاسخ هوش مصنوعی Ai Python

```
from tkinter import *
from tkinter import messagebox
from PIL import Image
from PIL import ImageTk

class PH:
def init(self):
self.windo = None
self.image_windo = None
self.icon_windo = None
self.lable_windo = None
self.entry_windo = None
self.dell_btn_windo = None
self.enter_windo = None
self.close_btn_windo = None
self.new_windo = None
self.image_new = None
self.icon_new = None
self.lable_new = None
self.close_btn_new = None

def dell_btn_windo_enter(self,e):
    self.dell_btn_windo.config(background="white",foreground="#FF8C00",cursor="hand2")
def dell_btn_windo_leave(self,e):
    self.dell_btn_windo.config(background="black",foreground="#FF8C00",cursor="arrow")

def enter_btn_windo_enter(self,e):
    self.enter_windo.config(background="white",foreground="#7CFC00",cursor="hand2")
def enter_btn_windo_leave(self,e):
    self.enter_windo.config(background="black",foreground="#7CFC00",cursor="arrow")

def close_btn_windo_enter(self,e):
    self.close_btn_windo.config(background="white",foreground="#6B8E23",cursor="hand2")
def close_btn_windo_leave(self,e):
    self.close_btn_windo.config(background="black",foreground="#6B8E23",cursor="arrow")

def dell_entry(self):
    self.entry_windo.delete(0,END)

def close_windo(self):
    self.windo.destroy()

def close_new_enter(self,e):
    self.close_btn_new.config(background="white",fg="blue",cursor="hand2")
def close_new_leave(self,e):
    self.close_btn_new.config(background="black",fg="blue",cursor="arrow")

def amaliat(self):
    try:
        num = int(self.entry_windo.get())

        if num < int(7):
            natije = "asidi"

        if num == int(7):
            natije = "khonsa"

        if num > int(7):
            natije = "bazi"

        self.new_windo = Toplevel(self.windo)
        self.new_windo.title("natije")
        self.new_windo.geometry("250x250")
        self.new_windo.config(background="black")
        self.new_windo.resizable(False,False)

        self.image_new =Image.open("image/download (3).png")
        self.icon_new = ImageTk.PhotoImage(self.image_new)
        self.new_windo.iconphoto(False,self.icon_new)

        self.lable_new = Label(self.new_windo,text=natije,font=("arial",14),bg="black",fg="#DAA520",width=13)
        self.lable_new.pack(padx=10,pady=20)



        self.close_btn_new = Button(self.new_windo,text="

ارسال جواب

جوابت را با Markdown بنویس و ثبت کن

×
بستن