November 28, 2019

To guess number between 0 zero and 100 hundred in python


To guess number between 0 zero and 100 hundred in python


if __name__=='__main__':
    isnum=False
    num=100
    upprnge=100
    lwrnge=0
    lst=[]
    print('Think of number between 0 and 100..')
    while not isnum:
        print(num, upprnge,lwrnge)
        isnum1 = input("Is "+str(num)+" the number?y/n ")
        if isnum1=='y':
            isnum=True
        elif isnum1=='n':
            isnum2 = input("Is "+str(num)+" high?y/n ")
            if isnum2=='y':
                if upprnge >= num:
                    upprnge=num
                    num = lwrnge + round((upprnge-lwrnge)/2,0)
            elif isnum2=='n':
                if lwrnge <= num:
                    lwrnge=num
                num = upprnge - round((upprnge-lwrnge)/2,0)
            lst.append(num)
            print(lst)
    print('number is ', num)


Developed in python by steffi

November 21, 2019

Tic Tac Toe algorithm and source code in python

Tic Tac Toe algorithm and source code in python

After a short break, This the first program I wrote in python

n=3#int(input("Enter size of board! "))

def printbox(lst):
    for i in range(2*n+1):
        if i%2==0:
            for k in range(n):
                if k==0:
                    print('  ', end='')
                print('----  ', end='')
        else:
            for k in range(n+1):
                if k==n:
                    print(' |', end='')
                else:
                    pp = addcolor(lst[(i-1)/2,k])
                    print(' |',pp, end='')
        print('')

def addcolor(num):
    if num == 1:
        return '\033[0;37;41m '+str(num)+'\033[0m'
    elif num==2:
        return '\033[0;37;46m '+str(num)+'\033[0m'
    return num

import numpy as np
#strlst = '1,0,1,2,1,1,0,2,1'#input("give 9 numbers")
lst=np.zeros(9).reshape(3,3)

def iswinner(lst):
    printbox(lst)
    
    issame=True
    knum=0
    for i in range(3):
        if np.all(lst[i,:]==1) or np.all(lst[:,i]==1):
            return(1)
        elif np.all(lst[i,:]==2) or np.all(lst[:,i]==2):
            return 2
        if i==0:
            knum=lst[i,i]
        elif issame and knum!=lst[i,i]:
            issame=False
    if issame and knum!=0:
        return knum
    return 0

s=0
while s<9:
    strlst1 = input('your move i,j,number')
    i,j,knum=strlst1.split(',')
    if (s%2==0 and int(knum)==1) or (s%2==1 and int(knum)==2):
        lst[i,j]=knum
        iswin = iswinner(lst)
        if iswin == 1:
            print('1 is winner')
            break
        elif iswin==2:
            print('2 is winner')
            break
        else:
            print('no win')
        s+=1
    else:
        print('enter valid number')



paste code in 
and run





Developed by steffi thomas

November 14, 2019

FibonacciSeries using recursion - only two lines of code

/**
 * FibonacciSeries using recursion
 */
package com.konzerntech.kozhikode;

/**
 * @author Alwin
 *
 */
public class FibonacciSeries {

/**
* @param args
*/
public static void main(String[] args) {
FibonacciSeries f = new FibonacciSeries();
int count = 49;
int first = 0;
int second = 1;
f.fibonacci(first, second, count);
}

private void fibonacci(int first, int second, int count) {
if (count != 0) {
System.out.print(first + " ");
fibonacci(second, first + second, count - 1);
}
}

}


Output

0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 2178309 3524578 5702887 9227465 14930352 24157817 39088169 63245986 102334155 165580141 267914296 433494437 701408733 1134903170 1836311903 -1323752223 512559680


Tik Toc Toe in python, two player game, playing with computer complete source code available soon...


November 07, 2019

Civil Disobedience Movement (1930 - 1931) - video tutorial


  1. Gandhiji s demand to Lord irwin (present viceroy) in the form of 11 points ( includes abolition of salt tax)
  2. Gandhiji s statement evoked no response from the statement
  3. the next way is civil disobediance, including non payement of tax.
  4. Gandhiji plan to initiate the campain by breaking the salt law  
  5. Gandhiji march from sabarmathi asram to dandti with 71 members form march  12 to april 6 (24 days) - salt sathyagraha
  6. In Tamil Nadu, C Rajagopalachari led salt march from Tirchurappali to Vedaraniyam (Tanjore)
  7. In kerala,  K Kelappan led salt march from kozhikode to payanur
  8. Gandhiji was arrested in may 5, his place was taken up by Abbas Tayabji.
  9. He too was arrested and that place was taken up by Sarojini Naidu
  10. Another significant feature of this movement was the participation of women and teenagers.


November 01, 2019

The Girl who knows to code -The subsidy day


The subsidy day





Summer hot at its peak, its getting harder and harder to sit in office.
The Kerala government had ordered to give subsidies for 100 homes per day through the organization where we are working.

A Bulk sale every day, in additional we have to fight against all types of malpractices happening.
There was a loop hole in our software, where the user can change to past date and bill on any previous dates.
This was a nightmare to account  and business team.

He came up with a solution by restricting the window user to change the system date and grands only user privilege for units under the region.
Since the day administrator privilege was given to every one.

Its twelve minutes to twelve.
Call from the subsidy unit.
A staff aggressively shouting to Information Technology head who is on the other side of the call.

" We Cannot login to the software !!! ", the issue exist every day and still the team could not find why this happening?
A long queue of people who came to buy subsidies are waiting in front of them.

The situation get worse now.
After hours of struggle, the team identified the problem. and it was because of the restricted privilege of user account that he could not login. Since our software does not allow the user to login on past date.





Secure your P C Now



Read Next >> The disappointment day

Facebook comments