Last active
August 29, 2015 14:10
-
-
Save MishoG/932090c0296b0bc5a917 to your computer and use it in GitHub Desktop.
ალკანის ალკენის და ალკინის წვის რეაქციები.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
def cls(): | |
os.system(['clear','cls'][os.name == 'nt']) | |
def alkani(): | |
n=int(input('sheiyvanet C -s indeqsi: ')) | |
n4 = n | |
n1 = n4+1 | |
n3 = n4 | |
o = (3*n+1) | |
n2 = "" | |
if n == 1: | |
n = "" | |
n3 = "" | |
if o%2 == 0: | |
o = o | |
elif o%2!=0: | |
o = 2*o | |
n1 = 2*n1 | |
n2 = 2 | |
n3 = 2*n4 | |
print n2,'C',n,'H',2*n4+2,'+',o/2,'O2''------>',n3,'CO2','+',n1,'H2O' | |
def alkeni(): | |
n=int(input('sheiyvanet C -s indeqsi: ')) | |
n1 = n | |
o = (3*n) | |
n2 = "" | |
if o%2 == 0: | |
o = o | |
elif o%2!=0: | |
o = 2*o | |
n1 = 2*n | |
n2 = 2 | |
print n2,'C',n,'H',2*n,'+',o/2,'O2''------>',n1,'CO2','+',n1,'H2O' | |
def alkini(): | |
n=int(input('sheiyvanet C -s indeqsi: ')) | |
n1 = n-1 | |
n3 = n | |
o = (3*n-1) | |
n2 = "" | |
if o%2 == 0: | |
o = o | |
elif o%2!=0: | |
o = 2*o | |
n1 = 2*n1 | |
n2 = 2 | |
n3 = 2*n | |
print n2,'C',n,'H',2*n-2,'+',o/2,'O2''------>',n3,'CO2','+',n1,'H2O' | |
reaction = {1:alkani , 2:alkeni , 3:alkini} | |
def main(): | |
print 'airchiet tipi: ' | |
print '1 - alkani' | |
print '2 - alkeni' | |
print '3 - alkini' | |
react = int(input('sheiyvanet ricxvi:')) | |
if react in reaction: | |
reaction[react]() | |
else: | |
print 'Error' | |
menu() | |
def menu(): | |
print "\n-----------------------------" | |
print '1 - Tavidan gashveba' | |
print '2 - Gamosvla' | |
choice = int(raw_input('Airchiet qmedeba: ')) | |
if choice == 1: | |
cls() | |
main() | |
elif choice == 2: | |
sys.exit() | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment