def define_model(vocab_size, max_length): inputs1=m.Input(shape=(4096,)) fe1=m.Dropout(0.5)(inputs1) fe2=m.Dense(256, activation='relu')(fe1) inputs2=m.Input(shape=(max_length,)) se1=m.Embedding(vocab_size, 256, mask_zero=True)(inputs2) se2=m.Dropout(0.5)(se1) se3=m.LSTM(256)(se2) decoder1=m.add([fe2, se3]) decoder2=m.Dense(256, activation='relu')(decoder1) outputs=m.Dense(vocab_size, activation='softmax')(decoder2) model=m.Model(inputs=[inputs1, inputs2], outputs=outputs) model.compile(loss='categorical_crossentropy', optimizer='adam') model.summary() m.plot_model(model, to_file='model.png', show_shapes=True) return model
def adduser(): return add()
import modules c = modules.add(5, 8) print(c) c = modules.sub(5, 2) print(c) c = modules.mult(4, 2) print(c) c = modules.div(10, 5) print(c)
import modules c = modules.add(2, 8) print(c) c = modules.sub(2, 8) print(c) c = modules.mult(2, 8) print(c) c = modules.div(2, 8) print(c)
from modules import add print(add([10, 20, 49]))
from modules import add from modules import myList import math, random userRes = input( "Would you like to push the button of random numbers?\n\t1.Yes\n\t2.No\n_______________\n" ) if userRes == "No" or userRes == "no" or userRes == "NO" or userRes == "2": quit() elif userRes == "yes" or userRes == "Yes" or userRes == "YES" or uesrRes == "1": a = random.choice(myList) print("Your input has been saved in A") userResTwo = input( "Now would you like to push the random button once more?\n\t1.Yes\n\t2.No\n_______________\n" ) if userResTwo == "No" or userResTwo == "no" or userResTwo == "NO" or userResTwo == "2": quit() elif userResTwo == "yes" or userResTwo == "Yes" or userResTwo == "YES" or uesrResTwo == "1": b = random.choice(myList) print("Your input has been saved in B") print("Please wait a moment while we add up your results\n\n") x = add(a, b) print("\n\nAnd your sum is:\n", x)
import modules as calc print(calc.add(1,2) # You can import specific functions you need. # You can access the function directly. You don't want to mention the module. # from calculations import add # add(5, 10) # 15 # You can also import multiple functions # from calculations import add, multiple, divide # You can import all the functions # from calculations import * # add(10, 15) # multiple(4, 5) # divide(10, 3) # These will work for classes and variables too.
import modules a = int(input("enter the first number")) b = int(input("enter the second number")) modules.add(a, b) modules.sub(a, b)
import modules print(modules.add(5, 8)) print(modules.subtract(10, 5)) print(modules.multiply(12, 6))
import modules c = modules.add(1, 2) print(c)
import modules a = 5 b = 3 try: print("Resource opened") print(modules.add(a, b)) print(a / b) a = int(input("Enter a nummber")) print(a) except ZeroDivisionError as e1: print("Cannot divide number by 0", e1) except ValueError as e1: print("Invalid Input", e1) except Exception as e1: print("Something Went Wrong") finally: print("Resource closed")
import modules from modules import add s=modules.add(3,9) print(s) #g=add(4,6) #print(g)
import modules as m import datetime as dt #1 print("1 + 8 =", m.add(1, 8)) print("4 - 2 =", m.sub(4, 2)) print("6 * 6 =", m.mul(6, 6)) print("8 / 2 =", m.div(8, 2)) #2 d = dt.datetime.now() print(d) print(d.strftime("%Y")) # Or print(d.year) print(d.strftime("%B")) print(d.strftime("%m")) # Or print(d.month) print(d.strftime("%A")) print(d.strftime("%d")) # Or print(d.day) #3 yesterday = d - dt.timedelta(days=1) tomorrow = d + dt.timedelta(days=1) print("yesterday: ", yesterday) print("tomorrow: ", tomorrow)
import modules as mod import random print mod.add(2) print mod.multiply(3)
import modules print modules.add(10, 12) print modules.multiply(5, 5) print modules.subtract(5, 5) print modules.divide(5, 5) print modules.count_string("hello") print modules.upper_string("hello world") print modules.reverse_string("yolo") print modules.opening_greeting("Theo") print modules.closing_greeting("Theo")
import modules c = modules.add(8, 9) print(c) d = modules.sub(4, 2) print(d)