تشخیص اسیدی یا بازی بودن ماده بر اساس پیاچ
برنامهای بنویسید که مقدار pH یک ماده را دریافت کند و مشخص نماید که ماده اسیدی، بازی یا خنثی است. اگر pH کمتر از 7 باشد، خروجی "اسیدی" خواهد بود؛ اگر برابر 7 باشد، "خنثی" و اگر بیشتر از 7 باشد، "بازی".
برنامهای بنویسید که مقدار pH یک ماده را دریافت کند و مشخص نماید که ماده اسیدی، بازی یا خنثی است. اگر pH کمتر از 7 باشد، خروجی "اسیدی" خواهد بود؛ اگر برابر 7 باشد، "خنثی" و اگر بیشتر از 7 باشد، "بازی".
def C_PH():
a = int(input('pH:'))
if a > 14:
print("error")
elif a < 7:
print("یدیسا")
elif a == 7:
print("یثنخ")
elif a > 7:
print("یزاب")
C_PH()
def check_ph():
ph = float(input("Enter pH value: "))
if ph < 7:
print("اسیدی")
elif ph == 7:
print("خنثی")
else:
print("بازی")
check_ph()
input_ph = int(input("Enter ph: "))
if input_ph < 7:
print("بازی")
elif input_ph == 7:
print("خنثی")
else:
print("اسیدی")
hp = int(input('hp:'))
if hp < 7:
print('bazi')
elif hp == 7:
print('khonsa')
elif 14 >= hp > 7:
print('asidi')
ph = int(input("Say the ph num :"))
if ph>7 :
print("base")
elif ph == 7 :
print("neutral")
elif ph < 7 :
print("acid")
ph = int(input())
if(ph == 7 ):
print("khonsa")
elif(ph < 7 ) :
print("asidi")
else:
print("bazi")
ph = int(input("enter ph: "))
if 0 > ph or ph > 14 :
print('error')
elif ph > 7 :
print('base')
elif ph < 7 :
print('acid')
else :
print('neutral')
```
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="
material = int(input ("ph :"))
if material > 7:
print("یزاب")
if material == 7:
print("یثنخ")
if material < 7:
print("یدیسا")
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نام