Posts

Java

  //candy problem import java . util . Arrays ; import java . util . Scanner ; public class Main {   public static void main ( String [] args ) {     System . out . println ( "Hello World" );     @ SuppressWarnings ( "resource" )     Scanner input = new Scanner ( System . in );         int n = input. nextInt ();     int [] arr = new int [n];     boolean [] ansarr = new boolean [n];     ansarr[ 0 ] = true ;       for ( int i = 0 ; i < n; i ++ ) {         arr[i] = input. nextInt ();         arr[i] = arr[i] + 3 ;       }           for ( int i = 1 ; i < ansarr. length ; i ++ ) {         if (arr[i] > arr[i - 1 ]) {           ansarr[i] = true ;         }         else {      ...

Node js

  const file = require ( 'fs' ); const result = file . writeFileSync ( "hello.txt" , "Hello my name is aditya" ); console . log ( result ); //hello.js console . log ( "hello" ); const math = require ( "./math" ); //console.log(math.add(3,5)); const value = math. add ( 3 , 5 ); console . log ( value ); //maths export function add ( a , b ){   return a + b ; } function sub ( a , b ){   return a - b ; } //we have to export functions to use them in other files because we run the server with only one file module . exports = { add , sub }; //server.js const http = require ( "http" ); const fs = require ( 'fs' ); const myserver = http . createServer (( req , res ) => { const log = ` ${ Date . now ()} : ${ req . url } :The request recieved \n ` ; fs . appendFile ( 'serverlog.txt' , log , ( req , res ) => { })   // console.log("request recieved");   switch ( req .url){   ...

objects in python

# Online Python compiler (interpreter) to run Python online. class Dog: # Class attribute species = "Canis familiaris" # Constructor method def __init__(self, name1, age): self.name= name1#jo pass karoge vo variable me jayega and variable ka name kuch bhi ho sakta hai bcz we access that with the help of variable name and due to self means it denotes objects same variable name is used for multiple objects bcz we refer variable by object likke self.name here self is object name it is referring to that object # Instance attribute self.age= age # Instance attribute # Instance method def bark(self): print(f"{self.name} barks!") # Instance method def get_info(self): return f"{self.name} is a {self.species} and is {self.age} years old." d1 = Dog("hi",20) info=d1.get_info() print(info)

React

import React from 'react' function changeuser() { let user ='Aditya'; console.log(user); function changename(){ user ="Aditya badiger"; console.log(user); } return ( The username is {user} change user ) } export default changeuser this code is not working because we store variables in a new way in react import React, { useState } from 'react' function App() { const [a, setA] = useState(1) return ( hello the number is {a} setA(a + 10)}>Incremenet setA(a-10)}>Decrement ) } export default App this code refers to creating variables

Apology

Apology Please Apologize me First click button 1 and then 2 You can only proceed when you click button 1 Apologize Your Favorite Junior Apology Message

Jarvis my first python project

import pyttsx3 import datetime import speech_recognition as sr engine = pyttsx3.init( 'sapi5' ) voices = engine.getProperty( 'voices' ) print (voices) engine.setProperty( 'voice' , voices[ 0 ].id) def speak (audio):     engine.say(audio)     engine.runAndWait() def wishMe ():       hour = int (datetime.datetime.now().hour)     if hour >= 0 and hour < 12 :         speak( "Good morning" )     elif hour > 12 and hour < 18 :         speak( "Good afternoon" )         speak( "I am jarvis how can i help you sir" )             else :         speak( "Good evening" )         speak( "I am jarvis how can I help you sir" )     def takeCommand ():     r = sr.Recognizer()     with sr.Microphone as source:         print ( "Listening..." ) if...

Float in CSS

Image
Float_challenge Using Float to Social Media Icons Facebook (stylized as facebook) is an American online social media and social networking service based in Menlo Park, California, and a flagship service of the namesake company Facebook, Inc. It was founded by Mark Zuckerberg, along with fellow Harvard College students and roommates Eduardo Saverin, Andrew McCollum, Dustin Moskovitz, and Chris Hughes. Instagram (commonly abbreviated to IG or Insta)[8] is an American photo and video sharing social networking service created by Kevin Systrom and Mike Krieger. In April 2012, Facebook acquired the service for approximately US$1 billion in cash and stock. The app allows users to upload media that can be edited with filters and organized by hashtags and geographical tagging. ...