Skip to main content

Posts

function in javascript

 here in this blog we are going to study about function in javascript repel for functions(fb login) so here is the code as follows // function in javascript function oneplusavg(x,y) {   console.log("done")   return Math.round(1+(x+y)/2) } // modern function writing way // this is arrow function const hello = ()=>{   console.log("arey maza aa gaya bhai") } let a=1; let b=2; let c=3; hello(); console.log("one plus average of a and b is ", oneplusavg(a,b)) console.log("one plus average of b and c is ", oneplusavg(b,c)) console.log("one plus average of a and c is ", oneplusavg(a,c))

while and do while loop in javascript

 so in this blog we will learn about the while and do while loop of javascript replit link(login with fb) here are the codes as follows // while loop in javascript let n=prompt("enter the value of n") n=Number.parseInt(n) let i=0; // while (i<n){ //   console.log(i) //   i++; // } // do while loop in javascript do{   console.log(i)   i++; }while(i<n)

for loop, for in loop, for of loop in javascript

 here in this blog we are going to work with the  for loop for in loop  for of  loop link for replit(login from fb) so here are the following codes as follows //for loop in javascript for (let i=0;i<5;i++){console.log(i)} // program to add first natural numbers let sum=0 let n = prompt("enter the value of n") n= Number.parseInt(n) for(let i=0;i<n;i++)//here we are using let so the value is only valid inside the curly brackets only but when we work with var instead of let than it becomes global and outside also i value can be obtained {sum += (i+1)} console.log("the sum of "+ n + " natural numbers is" + sum ) //for in loop in javascript // let obj = { //   sabih:99, //   anwar:98, //   shayaan:100, //   ghufrana:23, //   rizwana:66 // } // for(let a in obj){console.log("marks of "+ a+" are "+obj[a])} // // for of loop in javascript it mainly works in arrays // for(let b of "shayaan"){console.log(b)}

if else statement in javascript and ternary operator

 here in this blog we are going to work with the if else and the ternary operator also link for this example link for example replit ka login facebook see karo let a =prompt("hey whats your age"); a= Number.parseInt(a); if (a<0){alert("this is an invalid age")} if (a<9){alert("you are a kid and dont even think of driving")} if (a<18 && a>=9){alert("you can think of driving after 18")} if (a>18){alert("you are eligible for driving")} //here we are working with the ternary operator which satisfies the condition at the same line console.log("you can",(a<18?"not drive":"drive"))

how to add the data from list to the treeview in tkinter

 Here in this blog we are going to make the window where we can send all the data from the list to the treeview form. here is the following codes from tkinter import * from tkinter import ttk import sqlite3 root = Tk () root . geometry ( "500x600" ) #add some stylr style = ttk . Style () #Pick a theme style . theme_use ( "default" ) style . configure ( "Treeview" ,                 background = "white" ,                 foreground = "black" ,                 rowheight = 25 ,                 fieldbackground = "white" ) #change selected colour style . map ( 'Treeview' , background =[( 'selected' , 'blue' )]) #create treeview frame tree_frame = Frame ( root ) tree_frame . pack ( pady = 20 ) #treeview scrollbar tree_scroll = Scrollbar ( tree_frame ) tree_scroll . pack ( side = RIGHT , fill = Y ) #Create treeview my_tree = ...

Creating designed pages in tkinter

Here in this blog we can make the creative pages in tkinter for the entry section   So here are the following codes for that:- from tkinter import * user_form = Tk () user_form . geometry ( "750x450" ) user_form . title ( "Register form" ) user_form . resizable ( 0 , 0 ) pic1 = PhotoImage ( file = "user_form.png" ) user_form1 = Label ( user_form , image = pic1 , width = 750 , height = 450 ) user_form1 .image= pic1 user_form1 . pack () name_en = Entry ( user_form , width = 14 , relief = "flat" , font =( "times" , 20 )) name_en . place ( relx = 0.385 , rely = 0.265 ) user_en = Entry ( user_form , width = 19 , relief = "flat" , font =( "times" , 20 )) user_en . place ( relx = 0.385 , rely = 0.365 ) psswd_en = Entry ( user_form , width = 18 , relief = "flat" , font =( "times" , 20 )) psswd_en . place ( relx = 0.385 , rely = 0.485 ) pic3 = PhotoImage ( file = "register.png" ) but1 = Button...