atlas news
Python for Engineers
19  mai     04h00
Check if the characters in a string form a Palindrome in O(1) extra space
   def firstPos str start end firstChar for i in range start end if str i gt a and str i lt z firstChar i break return firstChardef lastPos str start end lastChar for i in range start end if str i gt a and str i lt z
17  mai     04h00
program to print all Prime numbers in an Interval
   def prime x y prime list for i in range x y if i or i continue else for j in range int i if i j break else prime list append i return prime liststarting range ending range lst prime starting range ending range if len lst
15  mai     04h00
Program for compound interest
   def compound interest principle rate time Amount principle pow rate time CI Amount principle print Compound interest is CI compound interest
13  mai     04h00
Tkinter-Text Widget
   from tkinter import root Tk root geometry x root title Q amp A def Take input INPUT inputtxt get end c print INPUT if INPUT Output insert END Correct else Output insert END Wrong answer l Label text What is inputtxt Text root
11  mai     04h00
Pattern Printing
   def Pattern line pat for i in range line for j in range line if j and i and i line or i or i line and j gt and j lt line or i line and j gt line and j lt line or j line and i and i line and i gt
09  mai     04h00
Program for Brick Sort
   def oddEvenSort arr n isSorted while isSorted isSorted temp for i in range n if arr i gt arr i
29  avril     10h18
Program for Find sum of even factors of a number
   import mathdef sumofFactors n if n return res for i in range int math sqrt n count curr sum curr term while n i count count n n i if i and count curr sum curr term curr term i curr sum
27  avril     03h30
Program for Legendre ’s Conjecture
   import mathdef isprime n i for i in range int math sqrt n if n i return False return Truedef LegendreConjecture n print Primes in the range n n and n n are for i in range n n n n if isprime i print i n
25  avril     03h30
Design with turtle
   import turtleturtle speed turtle bgcolor black for i in range for colours in red magenta yellow orange blue green purple turtle color colours turtle pensize turtle left turtle forward turtle left turtle forward turtle left turtle
19  avril     03h30
Counter to find the size of largest subset of anagram words
   from collections import Counterdef maxAnagramSize input input input split for i in range len input input i join sorted input i freqDict Counter input print max freqDict values if name main input ant magenta magnate tan gnamate maxAnagramSize input
17  avril     03h30
program to count Even and Odd numbers in a List Using Python Lambda Expressions
   list odd count len list filter lambda x x list even count len list filter lambda x x list print Even numbers in the list even count print Odd numbers in the list odd count
15  avril     03h30
Break a list into chunks of size N
   my list python for engineers like complete solution for python related queries def divide chunks l n for i in range len l n yield l i i n n x list divide chunks my list n print x
13  avril     03h30
Matrix creation of n n Using next() itertools.count()
   import itertoolsN print The dimension str N temp itertools count res next temp for i in range N for i in range N print The created matrix of N N str res
12  avril     03h30
Program for Find remainder of array multiplication divided by n
   from functools import reducedef find remainder arr n nbsp nbsp sum reduce lambda x y x y arr nbsp nbsp remainder sum n nbsp nbsp print remainder arr n find remainder arr n
10  avril     03h30
Reconstruct the array by replacing arr[i] with (arr[i-1] 1) % M
   def construct n m a ind for i in range n if a i ind i break for i in range ind if a i a i a i m m for i in range ind n if a i a i a i m print a n m a construct n m a
06  avril     03h30
Program for Number of stopping station problem
   def stopping station p n num dem s p while p dem p p t n s while t n s num t t if n s gt s return int num dem else return num stopping station if num print num else print Not Possible
30  mars     03h30
Pattern matching with Regex
   import rephoneNumRegex re compile r d d d d d d d d d d mo phoneNumRegex search My number is print Phone number found mo group
23  mars     03h30
Draw Among Us Character with Turtle
   import turtlecolor yellow color color skyblue color s turtle getscreen t turtle Turtle def x t pensize t fillcolor color t begin fill t right t forward t right
21  mars     03h30
Colored Hexagons Turtle
   import turtlefrom random import randintx y turtle speed turtle colormode def move l a turtle right a turtle forward l def hex turtle
19  mars     03h30
Generating random strings until a given string is generated
   import stringimport randomimport timepossibleCharacters string ascii lowercase string digits string ascii uppercase t hi attemptThis join random choice possibleCharacters for i in range len t attemptNext completed Falseiteration while completed
17  mars     03h30
Check if Binary representation is Palindrome
   def binaryPallindrome num binary bin num binary binary return binary binary if name main num print binaryPallindrome num
15  mars     03h30
Program to accept string ending with alphanumeric character
   import reregex a zA z def check string if re search regex string print Accept else print Discard if name main string python check string string python check string string python check string string python check string
13  mars     03h30
Program for Recursive Insertion Sort
   def insertionSortRecursive arr n if n lt return insertionSortRecursive arr n last arr n j n while j gt and arr j gt last arr j arr j j j arr j lastif name main A n len A
09  mars     03h30
Finding sum of digits of a number until sum becomes single digit
   import mathdef digSum n sum while n gt or sum gt if n n sum sum sum n n return sumn print digSum n
07  mars     03h30
Check whether a number has consecutive 0’s in the given base or not
   def hasConsecutiveZeroes N K z toK N K if check z print Yes else print No def toK N K w s while N r N K N N K s r w s w return sdef check N fl False while N r N N N if fl True and r return False if