Posts

Showing posts from August, 2020

NumToWord

 #@roshanb79 def convToWord(num): sflw=[] lastc='' uth="" for i in reversed(num): if len(sflw)==0: #checking is list is empty sflw.append(numwords1[i]) uth+="unit:"+i elif len(sflw)==1: uth+=",tens:"+i if i=="0": sflw.append("") elif lastc=="0": sflw[0]="" sflw.append(numwords3[i]) elif i=="1": sflw.pop(0) sflw.append(numwords2[lastc]) else: sflw.append(numwords3[i]) elif len(sflw)==2: uth+=",hundred:"+i if i=="0": sflw.append("") else: if sflw[0]=="" and sflw[1]=="": sflw.append(numwords1[i]+" Hundred") else: sflw.append(numwords1[i]+" Hundred And ") else: print("Give Number between 0-999") lastc=i finalword="" for word in reversed(sflw): finalword+=word print(finalword) print(...

csvTableToHtml

#roshanb79 def convertToHtml(filename,sep): tbody=[] with open(filename,"r") as f: for line in f.readlines(): tbody.append(line.split(sep)) htmlcode="<table>" for tr in tbody: htmlcode+="<tr>" for td in tr: htmlcode+=f"<td>{td}</td>" htmlcode+="</tr>" htmlcode+="</table>" print(htmlcode) sep=input("Input Your Column Seperator") convertToHtml("table.csv",sep)

JAVA OOP Example #4

class Student{   int rollno;   String name;   int m1;   int m2;   int m3;   int T;   Student(){     this.rollno=04;     this.name="Roshan Bhardwaj";     this.m1=41;     this.m2=43;     this.m3=36;     this.T=m1+m2+m3;   }   Student(int rollno,String name,int m1,int m2,int m3){     this.rollno=rollno;     this.name=name;     this.m1=m1;     this.m2=m2;     this.m3=m3;     this.T=m1+m2+m3;   }   public void printdetails(){     System.out.println("Rollno:"+rollno);     System.out.println("Name:"+name);     System.out.println("Marks1:"+m1);     System.out.println("Marks2:"+m2);     System.out.println("Marks3:"+m3);     System.out.println("Total Marks:"+T);   }    } class Result extends Student{  public void getResult(){   if(T>40){ ...