Best Python code snippet using autotest_python
buildbot.py
Source:buildbot.py
1#!/bin/env python32# -*- coding: UTF_8 -*-34# ///////////////////////////////////////////////////////////////////////////////////5# YIANG (v2.0)6# [buildbot.py]7# (c) 2008-2011 Yiang Development Team8#9# HIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND10# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED11# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 12# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR13# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES14# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 15# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 16# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 17# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 18# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.19# ///////////////////////////////////////////////////////////////////////////////////2021import sys22import operator23import traceback2425from abbrev import *2627caches = dd(lambda:[], {})28seps = {29 '==' :True, 30 '<=' :True, 31 '>=' :True, 32 '!=' :True, 33 '<' :True,34 '>' :True, 35 '\n' :False, 36 '\t' :False, 37 ' ' :False, 38 '(' :True,39 ')' :True,40 '`' :True41}4243# -----------------------------------------------------------------------------------44class ourdd(dict):45 def __init__ (self, d):46 dict.__init__(self, d)4748 def __missing__(self, key):49 # check conversion to integer50 try:51 return int(key)52 except ValueError as v:53 pass5455 # check conversion to float56 try:57 return float(key)58 except ValueError as v:59 pass6061 # check for boolean constants62 if key == 'True':63 return True64 if key == 'False':65 return False6667 # check for string literal68 #if key[]6970 raise KeyError()7172 def __repr__(self):73 return "<constants>"7475# -----------------------------------------------------------------------------------76def single_yield(scope):77 yield scope7879# -----------------------------------------------------------------------------------80class Error(BaseException):81 pass8283def error(scope, msg):84 print('[bot] ' + msg)85 for t in scope:86 if '_name' in t:87 print('@ ', t['_name'])88 89 raise Error()9091def warn(scope, msg):92 print('[bot] ' + msg)93 for t in scope:94 if '_name' in t:95 print('@ ', t['_name'])9697# -----------------------------------------------------------------------------------98def tokenize(lines):99 def tokenize_line(line):100 # XXX - terrible101 res, gotone = [], False102103 while True:104 mins = []105 for k, v in seps.items():106 n = line.find(k)107 if n != -1:108 mins.append((n, k, v))109110 if not len(mins):111 break112113 gotone = True114115 n = min(mins, key=operator.itemgetter(0))116 if n[0] > 0:117 res.append(line[:n[0]])118 if n[2]:119 res.append(line[n[0]:n[0] + len(n[1])])120121 line = line[n[0] + len(n[1]):]122 123 return line if not gotone else (res + [line] if len(line) else res)124125 inbracket = False126 for line in lines:127 128 if inbracket:129 idx = line.find("{")130 if idx != -1:131 nested += 1132 133 idx = line.find("}")134 if idx != -1:135 nested -= 1136 137 if nested==0:138 inbracket = False139 bracket += line[:idx+1]140 line = line[idx+1:]141 142 if bracket:143 yield orig + [bracket] + [n for n in tokenize_line(line)]144 continue145 146 if inbracket:147 bracket += line+"\n"148 continue149 150 if line[:1]=='#':151 continue152 153 idx = line.find("{")154 if idx != -1:155 inbracket = True156 bracket = line[idx:]+"\n"157 orig = tokenize_line(line[:idx])158 nested = 1159 continue160161 s = tokenize_line(line)162 if len(s):163 yield s164 165# -----------------------------------------------------------------------------------166def exec_single_statement(scope, item, out_item_idx, lines, n):167168 call = item[0]169 170 idle = 0171 fa = [scope]172 gen = enumerate( item[1:] )173 try:174 while True:175 nn,arg = next( gen )176 if arg == "(":177 out = [0]178 idle += exec_single_statement(scope, item[nn+2:], out, lines, n)179 gen = enumerate( item[out[0]+nn+4:] )180 181 s = lookup_nofault(scope, "_")182 183 fa.append(s if s else "null")184 continue185 186 elif arg == ")":187 out_item_idx[0] = nn188 break189 190 if arg == "`":191 combined = []192 nn,arg = next( gen )193 while arg != "`":194 combined.append(arg)195 nn,arg = next( gen )196 197 arg = " ".join(combined)198 s = None199 elif arg[0:1] != "{":200 s = lookup_nofault(scope, arg)201 else:202 s = arg203 204 fa.append(s if not s is None else arg)205 206 except StopIteration:207 pass208209 bfnc = 'block_' + call210 if bfnc in globals():211 try:212 #print(lines[n+1:])213 idle = execute(scope, globals()[bfnc], fa, lines[n + 1:]) + 1214 except Error as ours:215 raise216 except BaseException as err:217 traceback.print_exc()218 error(scope, "'%s' received a wrong number/type of arguments" % call)219220 return idle221222 bfnc = 'func_' + call223 if bfnc in globals():224 try:225 #print(bfnc)226 scope[-1]["_"] = globals()[bfnc](*fa)227 except Error as ours:228 raise229 except BaseException as err:230 traceback.print_exc()231 error(scope, "'%s' received a wrong number/type of arguments" % call)232 233 return idle234235 error(scope, 'Unknown callable: %s' % call)236 return idle237 238 239# -----------------------------------------------------------------------------------240def execute(scope, group, args, lines):241 n = 0242 for newscope in group(*args):243 scope += [newscope]244245 idle = -1246 for n, item in enumerate(lines):247 if idle > 0:248 idle -= 1249 continue250 251 call = item[0]252 if call == 'end':253 break254 255 if call[:1] == '#':256 continue257 258 out = [0]259 idle += exec_single_statement(scope,item, out, lines, n)260 261 #assert out[0] == len(item)-1262263 scope.pop()264 return n+1265266267# -----------------------------------------------------------------------------------268def lookup_nofault(scope, name, local=False):269 for tt in scope[-1::-1]:270 #print(tt)271 try:272 return tt[name]273 except KeyError:274 pass275 276 if local and "_dir" in tt:277 break278 279 return None280281# -----------------------------------------------------------------------------------282def lookup(scope, name, local=False):283 res = lookup_nofault(scope, name, local)284 if res is None:285 #print(scope)286 error(scope, 'Name not found: %s' % name)287 return None288289 return res290291# -----------------------------------------------------------------------------------292def get_base_scope(scope):293 return next(iter(s for s in scope[-1::-1] if "_dir" in s))294295# -----------------------------------------------------------------------------------296def block_group(scope, kind, *args):297 pd = lookup(scope, "_dir")298 299 expr = args[0] if len(args) else None300 if kind == "unpushed" or kind == "up":301 s = get_base_scope(scope) 302 def group_filter(fname):303 f = s.get("_pushed")304305 return not (f and opj(pd, fname) in f) 306 307 #scope,kind,expr = args308 elif kind == "wc" or kind == "wildcard":309 if expr == "*":310 group_filter = (lambda x: True)311 else:312 import re313 expr = expr.replace(".","\\.").replace('*', r'[a-zA-Z0-9_-]+')314 kind = "re"315 elif kind == 'type':316 if expr == 'dir':317 group_filter = (lambda t: opid(opj(pd, t)))318 319 elif expr == 'file':320 group_filter = (lambda t: opif(opj(pd, t)))321 322 else:323 error(scope, 'Invalid typecode in group `type` statement: %s' % expr)324 325 elif kind != "re" and kind != "regex":326 error(scope, 'Invalid kind in group statement: %s' % kind)327 else:328 kind = "re"329330 if not "group_filter" in locals():331 import re 332 group_filter = (lambda x,e=re.compile(expr): re.match(e,x))333 334 scope[-1]['_group_filter'] = gf = lambda x: not not (x != "$build" and group_filter(x))335 try:336 base = lookup_nofault(scope, "~~", True)337 if base:338 base = [base]339 else:340 base = old(pd)341 342 for t in base:343 #print(expr,t,gf(t))344 #import time345 #time.sleep(0.05)346 if gf(t):347 yield {'~':opj(pd, t),"~~":t}348 349 except(OSError):350 pass351 352353# -----------------------------------------------------------------------------------354def block_if(scope, *args):355 e0 = args[0]356 if len(args) == 1:357 # if single_boolean_expression358 if e0 == 'True' or e0 != '0':359 yield {}360 scope[-1]['_doelse'] = False361 return362363 if len(args) != 3:364 error(scope, 'Invalid syntax for if: expect "if e0" or "if e0 op e1"')365 366 e1, op = args[2], args[1]367 ops = {368 '==': lambda x, y:x == y,369 '<': lambda x, y:x < y,370 '>': lambda x, y:x > y,371 '<=': lambda x, y:x <= y,372 '>=': lambda x, y:x >= y,373 '!=': lambda x, y:x != y,374 'endswith' : lambda x, y:x[-len(y):] == y,375 '!endswith' : lambda x, y:x[-len(y):] != y,376 'contains' : lambda x, y:x.find(y) != -1,377 '!contains' : lambda x, y:x.find(y) == -1,378 }379380 if args[1] not in ops:381 error(scope, 'Unknown operation in if statement: %s' % op)382 return383384 if ops[op](e0, e1):385 yield {}386 scope[-1]['_doelse'] = False387 return388 389 scope[-1]['_doelse'] = True390 return391392# -----------------------------------------------------------------------------------393def block_else(scope):394 if not '_doelse' in scope[-1]:395 error(scope, 'Unexpected else')396 return397 398 if scope[-1]['_doelse'] == True:399 yield {}400 401 scope[-1]['_doelse'] = False402403404# -----------------------------------------------------------------------------------405def block_elseif(scope, expr0, op, expr1):406 if not '_doelse' in scope[-1]:407 warn('Unexpected else')408 return409 410 if scope[-1]['_doelse'] == True:411 for t in block_if(scope, expr0, op, expr1):412 yield {}413 414 scope[-1]['_doelse'] = False415 416# -----------------------------------------------------------------------------------417def func_expand(scope, file):418 _dir = lookup(scope, "_dir")419 return file if file[:len(_dir)]==_dir else os.path.join(_dir, file)420421# -----------------------------------------------------------------------------------422def func_is_in_hg(scope, file):423 print("not currently implemented: is_in_hg")424 return True425 426# -----------------------------------------------------------------------------------427def func_is_in_working_copy(scope, type, file):428 429 if type == "hg":430 return func_is_in_hg(scope, file)431 else:432 print("{0} is not currently supported".format(type))433 434 return False435436# -----------------------------------------------------------------------------------437def func_build(scope, file, *args):438 if file.find('\\') != -1 or file.find('/') != -1:439 nxt = file440 else:441 nxt = opj(lookup(scope, '_dir'), file)442 443 bc = lookup(scope,"_build_set")444 if nxt in bc:445 return446 447 if len(args) >= 1:448 if (args[0][0] != "{" or args[0][-1] != "}"):449 warn(scope, 'Failure building %s, given build script is not valid: %s' % (nxt,args[0]))450 return451 452 lines = args[0][1:-1].split("\n")453 else:454 try:455 lines = open(opj(nxt, '$build'), 'rt').readlines()456 except:457 warn(scope, 'Failure building %s, $build file not found' % nxt)458 return459460 print('BUILD %s/$build' % nxt)461 #print(nxt,file)462 463 bc.add(nxt)464 execute(scope+[{}], single_yield, [{'_dir':nxt, '_name':file}], list(tokenize(lines)))465466467# -----------------------------------------------------------------------------------468def func_run(scope, *args):469 file = args[0]470 func = args[1] if len(args) > 1 else None471 print('RUN %s.%s()' % (file, func))472 473 full = os.path.join( lookup(scope, '_dir'), file )474 myd,myf = os.path.split(full)475 sys.path.insert(0, myd)476 477 if os.path.splitext(myf)[1].lower() in ( ".bat", ".sh" ):478 prv = os.getcwd()479 print("Execute external shell script: {0}".format(full))480 os.chdir(myd)481 os.system(myf)482 os.chdir(prv) # doesn't wait() on linux!483 return484485 try:486 mod = __import__(myf)487 except ImportError as imp:488 warn(scope, 'Failure importing %s' % file)489 del sys.path[0]490 return491492 if not func is None:493 prv = os.getcwd()494 for tt in sys.path:495 try:496 for mm in old(tt):497 if mm == file + '.py':498 os.chdir(tt)499 except:500 pass501 try:502 mod.__dict__[func](*args[2:])503 except BaseException as e:504 print(e)505 warn(scope, 'Failure calling %s.%s()' % (file, func))506 os.chdir(prv)507 508 del sys.path[0]509510# -----------------------------------------------------------------------------------511def func_print(scope, *args):512 print(*args)513 514# -----------------------------------------------------------------------------------515def func_set(scope, var, val):516 ss = lookup_nofault(scope, val)517 print('SET ', var, ' = ', val)518 scope[-1][var] = ss if ss else val519520# -----------------------------------------------------------------------------------521def func_push(scope, cache, *args):522 if not len(args):523 error('Not enough arguments to push')524 525 s = get_base_scope(scope) 526 for elem in args:527 if not elem in caches[cache]:528 print('PUSH %s to %s' % (elem, cache))529 caches[cache].append(elem)530 531 s.setdefault("_pushed",set()).add(elem)532 533# -----------------------------------------------------------------------------------534def func_splice(scope, string, *args):535 args = [int(a) for a in args]536 return string[args[0] if len(args)>0 else 0 : args[1] if len(args)>1 else len(string) : args[2] if len(args)>2 else 1]537538# -----------------------------------------------------------------------------------539def main():540 try:541 execute([ourdd({'caches':caches,"_build_set":set()})], single_yield, [{'_dir':'.'}], [['build', '..']])542 except Error as err:543 print('[bot] Exiting with errors')544 return545546 print('[bot] Bot run successful!')547548 # needs to be called manually with RUN xxx549"""550 builders = []551 for t in old('.'):552 if opse(t)[-1]=='.py' and t.find('__builder__')==0:553 try:554 bld = __import__(t[0:-3])555 except:556 continue557558 print('Load builder: %s'%t)559 builders.append(bld)560561562 print('[bot] Loaded %s builders!'%len(builders))563 for bd in builders:564 bd.main(caches)565"""566 567568 569 570571if __name__ == '__main__':572 main()573 input('All done, waiting for keystroke ')574
...
HePyL.py
Source:HePyL.py
1import re2from bidi.algorithm import get_display3import sys4from matplotlib.pyplot import cla5"""6 5 - 3 + 10 => ((5 - 3) + 10)7 5 * 10 / (3 + 33) => (5 * 10) / (3 + 33)8 5 * 10 / 3 * 2 => (((5 * 10) / 3) * 2)9 <pt> := <Number>10 | ( <nop> )11 <Vals> := <String>12 | <Number>13 <sop> := <String>14 | <sop> + <String>15 | <sop> + <Number>16 <nop> := <pt>17 | <nop> + <pt>18 | <nop> - <pt>19 | <nop> / <pt>20 | <nop> * <pt>21 <bop> := 'True22 | 'False23 | <nop>24 | <sop>25 | ( <bop> or <bop> )26 | ( <bop> and <bop> )27 | <bop> == <bop>28 | <sop> == <sop>29 | <sop> != <sop>30 | <bop> != <bop>31 | <nop> == <nop>32 | <nop> != <nop>33 | <nop> > <nop>34 | <nop> < <nop>35 | <nop> <= <nop>36 | <nop> >= <nop>37"""38def hError(line, error):39 sys.exit(get_display("ש×××× ×ש××¨× " + str(line) + " : " + error))40def clear_scope(args: list, vals: list):41 current = args.pop()42 vals.pop()43 while current != "$":44 current = args.pop()45 vals.pop()46def override_variable(args: list, vals: list, arg, val):47 for i in range(len(args) - 1, -1, -1):48 if args[i] == arg:49 vals[i] = val50 return True51 return False52def add_variable(args: list, vals: list, arg, val):53 for i in range(len(args) - 1, -1, -1):54 if args[i] == "$":55 break56 if args[i] == arg:57 vals[i] = val58 return59 args.append(arg)60 vals.append(val)61def get_val(args, vals, arg, line_number):62 if arg[0] == "\"":63 return arg[1:]64 if arg.isdigit():65 return int(arg)66 if arg.replace('.', '', 1).isdigit():67 return float(arg)68 elif arg == "××":69 return False70 elif arg == "××":71 return True72 else:73 for i in range(len(args) - 1, -1, -1):74 if args[i] == arg:75 return vals[i]76 hError(line_number, " : ×××©×ª× × " + arg + " ×× ××××ר!")77operations = ["+", "-", "*", "/", "==", "!=",78 "<=", ">=", "<", ">", ",", "=", "(", ")", ")"]79def find_split(word, symbols: list):80 words = []81 ln = len(symbols) - 182 def fs(word, current):83 symbol = symbols[current]84 x = word.find(symbol)85 while x >= 0:86 if current >= ln:87 words.append(word[: x])88 else:89 fs(word[: x], current + 1)90 words.append("$" + symbol)91 word = word[x + len(symbol):]92 x = word.find(symbol)93 if(len(word) > 0):94 if current >= ln:95 words.append(word)96 else:97 fs(word, current + 1)98 fs(word, 0)99 return words100def extended_split(vec: list):101 arr = []102 for word in vec:103 if word[0] == "\"":104 arr.append(word)105 continue106 elif word == "××":107 arr.append("$××")108 continue109 elif word == "×××":110 arr.append("$×××")111 continue112 arr += find_split(word, operations)113 return arr114def compute_val(args, vals, vec: list, line_number):115 if len(vec) == 0:116 return117 def execute_operation(operation, right, left):118 # print(right, operation, left)119 if operation == "+":120 if type(right) == str or type(left) == str:121 return str(right) + str(left)122 right += left123 elif operation == "-":124 right -= left125 elif operation == "*":126 right *= left127 elif operation == "/":128 right /= left129 elif operation == "==":130 right = right == left131 elif operation == "!=":132 right = right != left133 elif operation == ">":134 right = right > left135 elif operation == "<":136 right = right < left137 elif operation == ">=":138 right = right >= left139 elif operation == "<=":140 right = right <= left141 elif operation == "××":142 return bool(right or left)143 elif operation == "×××":144 return bool(right and left)145 elif operation == "<>":146 hError(line_number, "פע××× ×× ××××רת")147 return right148 i = 0149 depth = 0150 operation = "+"151 val = 0152 if type(get_val(153 args, vals, vec[0], line_number)) == str:154 val = ""155 prev = []156 while i < len(vec):157 word = vec[i]158 i += 1159 if word[0] == "$":160 if word[1] == "(":161 # cv(word)162 depth += 1163 prev.append((operation, val))164 val = 0165 operation = "+"166 continue167 elif word[1] == ")":168 depth -= 1169 if depth < 0:170 hError(line_number, "×ש ס××ר ס×××¨× ×××תר (.")171 po, pval = prev.pop()172 val = execute_operation(po, pval, val)173 operation = "<>"174 else:175 operation = word[1:]176 else:177 val = execute_operation(operation, val, get_val(178 args, vals, word, line_number))179 operation = "<>"180 if depth > 0:181 hError(line_number, "×ש ס××ר פת××× ( ××× ××× ×¡××ר ס×××ת ).")182 return val183def text_spliter(s, line_number):184 sp = []185 x = s.find("\"") + 1186 while x > 0:187 current = x188 y = s[x:].find("\"")189 while s[x + y - 1] == '\\':190 current = x + y + 1191 y = s[current:].find("\"")192 if y == -1:193 hError(line_number, "×ת××× ××§×¡× ××× ××× ×¡××ר ×קס×")194 sp += s[:x - 1].split()195 mystring = "\"" + s[x: current + y]196 sp.append(mystring)197 s = s[current + y + 1:]198 x = s.find("\"") + 1199 sp += s.split()200 return extended_split(sp)201 # return sp202class Interpretor():203 def __init__(self, filename) -> None:204 self.filename = filename205 self.IsDebug = True206 self.flip = True207 self.decodeding = []208 def log(self, output):209 if self.flip:210 print(get_display(str(output)))211 else:212 print(output)213 def debug(self, output):214 if self.IsDebug:215 print(output)216 def run(self):217 file1 = open(self.filename, 'r', encoding="utf-8")218 Lines = file1.readlines()219 args = []220 vals = []221 depth = 0222 skipDepth = 0223 doElse = False224 depth_arr = []225 # Strips the newline character226 skip = False227 efo = len(Lines)228 next_line = 0229 while next_line < efo:230 line = Lines[next_line]231 current_line = next_line232 next_line += 1233 if len(line) > 0:234 if line[0] == ";":235 skip = not skip236 continue237 if skip:238 continue239 x = text_spliter(line, current_line)240 # self.debug(str(current_line) + " : " + str(x))241 if len(x) == 0:242 continue243 if len(x) == 1:244 if(x[0] == "$-"):245 if(depth == 0):246 hError(current_line, "ס×××ת ×©× ×¡×§×¦×× - ××ק×× ×× ××ק×!")247 do = depth_arr.pop()248 if skipDepth == 0:249 clear_scope(args, vals)250 else:251 skipDepth -= 1252 depth -= 1253 doElse = do[0]254 goto = do[1]255 if goto >= 0:256 next_line = goto257 # print("goto", goto)258 continue259 if(x[0] == "××רת"):260 if skipDepth > 1:261 continue262 elif skipDepth == 1:263 if doElse:264 if len(x) > 1 and x[1] == "××":265 condition = compute_val(266 args, vals, x[2:], current_line)267 if condition:268 args.append("$")269 vals.append("-")270 doElse = False271 skipDepth = 0272 else:273 skipDepth = 0274 args.append("$")275 vals.append("-")276 else:277 skipDepth = 1278 continue279 if skipDepth > 0:280 if x[0] == "××" or x[0] == "××":281 depth += 1282 skipDepth += 1283 depth_arr.append([doElse, -1])284 doElse = False285 continue286 if len(x) > 1:287 if x[0] == "××":288 if x[1] == "×¢××":289 depth += 1290 goto = current_line291 condition = compute_val(292 args, vals, x[2:], current_line)293 if condition:294 args.append("$")295 vals.append("-")296 else:297 goto = -1298 skipDepth += 1299 # print(condition)300 depth_arr.append([doElse, goto])301 doElse = False302 else:303 hError(current_line, "ק×× ×©××× ×××¨× ×× ××¦×¤× ×-×¢××")304 elif x[0] == "××":305 depth_arr.append([doElse, -1])306 depth += 1307 condition = compute_val(308 args, vals, x[1:], current_line)309 if condition:310 args.append("$")311 vals.append("-")312 doElse = False313 else:314 skipDepth += 1315 doElse = True316 elif x[0] == "ת×פ×ס":317 message = compute_val(318 args, vals, x[1:], current_line)319 self.log(message)320 elif x[0] == "××××":321 if len(x) < 3 or x[2] != "$=":322 hError(current_line, "ק×× ×©×××!")323 arg = x[1]324 val = compute_val(325 args, vals, x[3:], current_line)326 add_variable(args, vals, arg, val)327 elif x[1] == "$=":328 arg = x[0]329 val = compute_val(330 args, vals, x[2:], current_line)331 # add_variable(args, vals, arg, val)332 if not override_variable(args, vals, arg, val):333 hError(current_line, "×ש××ª× × " + arg + " ×× ××××רת!")334 # else:335 # sys.exit(get_display("ש×××× ×ש××¨× " +336 # str(line_number) + " : ס×× ×קס ×× × ×××."))337 if depth > 0:338 hError(current_line, "ק×× ×©××× ×סר ס××£ סקצ××!")...
cal.py
Source:cal.py
...31 b=int(input("\nEnter Base: "))32 h=int(input("Enter height: "))33 34 print("\nArea of triangle =",(b*h)*1/2)35 doElse()36def circle():37 print("\n\nCalculating area of a circle:\n ")38 b=int(input("Enter radius: "))39 40 print("\nArea of circle=",3.423*b)41 doElse()42 43def doit():44 a=int(input("\nEnter a number: "))45 b=int(input("Enter a number: \n"))46 add(a,b)47 sub(a,b)48 mult(a,b)49 devide(a,b)50 doElse()51def doElse():52 print("\nDo you want me to do something else for you:\n1.Yes\n2.No")53 a=int(input("Response: "))54 if a==1:55 DoThings()56 elif a==2:57 print("Ooops u am done!!!")58 else:59 print("Your answer is wrong")...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!