Tuesday, 5 December 2023

Lecture 2 | Variables in Java | Input Output | Complete Placement Course

                                                                  JAVA PROGRAMMING

 

 

public class Main {
public static void main(String[] args) {
System.out.print("Hello World");
}
}
//output: Hello World
 
 
public class Main {
public static void main(String[] args) {
System.out.print("Hello World with Java");
}
}
//output: Hello World with Java
 
 
public class Main {
public static void main(String[] args) {
System.out.print("Hello World with Java");
System.out.print("Hello World with Java");
}
}

//output: Hello World with JavaHello World with Java
 
 
//println
public class Main {
public static void main(String[] args) {
System.out.println("Hello World with Java");
System.out.println("Hello World with Java");
System.out.print("Hello World with Java");
}
}

//output:
// Hello World with Java
// Hello World with Java
// Hello World with Java
 
 
 
 
//BACKSLASH N "\n"
public class Main {
public static void main(String[] args) {
System.out.print("Hello World with Java\n");
System.out.print("Hello World with Java\n");
System.out.print("Hello World with Java");
}
}

//output:
// Hello World with Java
// Hello World with Java
// Hello World with Java
 
 
 
//\n between words
public class Main {
public static void main(String[] args) {
System.out.print("Hello World with java \nfrom \nApni Kaksha");
}
}

//output:
// Hello World with java
// from
// Apni Kaksha
 
 
 
# Revise 
//Three way to print output in Java
//1. print
//2. println
//3. "\n"
 
 
 
//# question: print the pattern
public class Main {
public static void main(String[] args) {
//output
System.out.println("*");
System.out.println("**");
System.out.println("***");
System.out.println("****");
}
}

//output:
// *
// **
// ***
// ****

 
 
//NOTE: type sout and press enter to print the print statement shortcut
 
 
//# QUIZ: PRINT THE STARS
public class Main {
public static void main(String[] args) {
System.out.println("*");
System.out.println("**");
}
}
 
 
 
 
 
variables in java


public class Main {
public static void main(String[] args) {
//variables
String name = "tony stark";
System.out.println(name);
int a = 25;
int b = 10;
int age = 48;
System.out.println(a);
System.out.println(b);
System.out.println(age);

double price = 25.5;
System.out.println(price);

// change b and name value
b = 20;
name = "ironman";
System.out.println(b);
System.out.println(name);
}
}
 
 
 
// code for sum of two numbers
public class Main {
public static void main(String[] args) {
int a = 10;
int b = 25;
int sum = a + b;
System.out.println(sum);
}
}

//code for product of two numbers
public class Main {
public static void main(String[] args) {
int a = 10;
int b = 25;
int mul = a * b;
System.out.println(mul);
}
}
 

 
 
//quiz option solution
public class Main {
public static void main(String[] args) {
int a = 10;
int b = 5;
int ans = a * b / a - b;
System.out.println(ans);
}
}
 //output: 0
 
 
 
public class Main {
public static void main(String[] args) {
int a = 10;
int b = 5;
int ans = (a*b)/(a-b);
System.out.println(ans);
}
}

//output: 10
 
 
 
//taking input in java using scanner class
import java.util.*;

public class Main {
public static void main(String[] args) {
//Input
Scanner sc = new Scanner(System.in);
String name = sc.next();
System.out.println(name);
}
}
//output:
//input tony stark
//output tony
 
 
 
 //taking input using next line code
import java.util.*;
public class Main {
public static void main(String[] args) {
//Input
Scanner sc = new Scanner(System.in);
String name = sc.nextLine();
System.out.println(name);
}
}

//output:
// tony stark and iron man
// tony stark and iron man
 
 
 
import java.util.*;
public class Main {
public static void main(String[] args) {
//Input
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int sum = a + b;
System.out.println(sum);

}
}

//output:
// 100
// 100
// 200
 

Introduction to Java Language | Lecture 1 | Complete Placement Course

 

 //our first JAVA program !


public class Main {
public static void main(String[] args) {
System.out.println("Hello World");
}
}

Thursday, 27 April 2023

python in one shot.

 


# PYTHON IN ONE SHOT

Timestamps :
 - Introduction
 - Install Python (Windows & Mac - both)
 - Install PyScripter (only for Windows)
 - How to work with PyScripter?
 - Install PyCharm (Windows & Mac - both)
 - Creating a file
 - 1st Program (Output)
 - Variables
 - Exercise 1
 - Input
 - Concatenation
 - Exercise 2
 - Type Conversion
 - Print Sum of 2 Numbers
 - Strings
 - Keywords
 - Arithmetic Operators


print("Hello World")
# It is a case sensitive language
# variables
# boolean, integer, floaten, strings

#example 1 simple variable
name = "shradha"
age = 22
print(name)
print(age)

#example 2 how to change name and age
name = "shradha"
age = 22

name = "aman"
age = 24
print(name)
print(age)

#example 3 define variables with boolean type
first_name = "shradha"
last_name = "khapra"
age = 19
is_adult = True

print(first_name + " " + last_name)
print(age)
print(is_adult)

""" Exercise
* Add a person with name Tony Stark.
* Tony's age is 51
* Tony is a genius. """

# Exercise Solution

first_name = "Tony"
last_name = "Stark"
age = 51
is_genius = True

print(first_name + " " + last_name)
print(age)
print(is_genius)

# Taking input

name = input("what is your name ?")
print("Hello " + name)
print("Welcome to our cool python class")

""" Exercise
* Tony is secretely a Superhero. Ask him for his
superhero name & show it on the terminal."""

# Exercise Solution
superhero = input("what is your superhero name ?")
print(superhero)

# Type conversion
old_age = input("Enter your age : ")
#new_age = (old_age) + 2
#print(new_age)

new_age = int(old_age) + 2
print(new_age)

#useful conversion functions
# 1. float()
# 2. bool()
# 3. str()
# 4. int()

# code for sum of 2 Numbers

first_number = input("Enter 1st number : ")
second_number = input("Enter 2nd number : ")
sum = float(first_number) + float(second_number)
print("the sum is : " + str(sum))



# Strings
name = "Tony Stark"
print(name.upper())
print(name)

print(name.lower())
print(name)

print(name.find('y'))
print(name.find('Y'))
print(name.find("Stark"))
print(name.find("stark"))

print(name.replace("Tony Stark", "Ironman"))
print(name)

print(name.replace("Stark", "Ironman"))


# Arthmetic operators
print(5 + 2)
print(5 - 2)
print(5 * 2)
print(5 / 2)
print(5 // 2)
print(5 % 2)
print(5 ** 2)

i = 5
i = i + 5
i += 2
i -= 2
i *= 2

Tuesday, 25 April 2023

python turtle graphic (circle) by Amit Sharma

from turtle import *

speed(0)
bgcolor('black')
color('blue')

for i in range(858):
    fd(i*7/458+4)

    lt(1/7458+9)

    fd(390)
    rt(2766)

python practice time.py

 

#1 It's practice time !

print("Hello World")
print("Hello World")
print("Hello World")
print("Hello World ")
print("Hello World ")
print("Hello World")
print("Hello World ")
print("Hello World ")
print("Hello World")
print("Hello World")

#2

# variable are of four types bifs string, floating, integer, boolean.

#example 1

#variable
name = "shradha"
age = 22
print(name)
print(age)
#variables define krta hai ki memory me us location ka kya name hai.
# in simple words we can say that, variables is the name of the memory location.

#change the name in variables

#Example 2

name = "Shradha"
age = 22

name = "Amit"
age = 24
print(name )
print(age)

#Example 3 print variables with the help of boolean types

first_name = "Shradha"
last_name = "Khapra"
age = 19
is_adult = True
print(first_name + " " + last_name)
print(age)
print(is_adult)

first_name = "Tony"
last_name = "Stark"
age = 52
is_genius = "True"

print(first_name + " " + last_name)
print(age)
print(is_genius)

name = 'amit'
age = 18
is_genius = True

print(name)
print(age)
print(is_genius)

name = 'amit'
age = 12
is_genius = True

print(name )
print(age)
print(is_genius)

name = "Tony"
age = 13
is_genius = True

print(name)
print(age )
print(is_genius)

name = "Spiderman"
age = 24
is_genius = False

print(name)
print(age)
print(is_genius)

name = "phiens and ferb"
age = 10
is_genius = True

print(name)
print(age)
print(is_genius)

name = "phery the platepus"
age = 24
is_genius = True

print(name)
print(age)
print(is_genius)

name = "King kong"
age =13
is_genius = True

print(name)
print(age)
print(is_genius)

name = "Rabbit"
age = 14
is_genius = False

print(name)
print(age)
print(is_genius)

name = "Tony"
age = 15
is_genius = True

print(name)
print(age)
print(is_genius)

name = "Tony Stark"
age = 34
is_genius = False

print(name)
print(age)
print(is_genius)

name = "Wonder Women"
age = 25
is_genius = True

print(name)
print(age)
print(is_genius)

name = "Ben Tennysion"
age = 18
is_genius = True

print(name)
print(age)
print(is_genius)

name = "Jyoti Sharma"
age = 21
is_genius = True

print(name)
print(age)
print(is_genius)

name = "Gwen"
age = 10
is_genius

print(name)
print(age)
print(is_genius)

name = "Shradha Khapra"
age = 23
is_genius = True

print(name)
print(age)
print(is_genius)

# Taking input from user

superhero = input("what is your superhero name ?")
print(superhero)


name = input("what is your name ?")
print(name)

name = input("what is your name ?")
print(name)

name = input("what is your name")
print(name)

ben = input("what is your name")
print(ben)

name = input("what is your superhero name ?")
print(name)

name = input("what is your name ?")
print(name)

name = input("what is your name")
print(name)

name = input("what is your name")
print(name)

name = input("what is your superhero name ?")
print(name)

name = input("what is your superhero name ?")
print(name)

superhero = input("what is you name")
print(superhero)

superhero = input("what is your superhero name ?")
print(superhero)

phines_and_ferb = input("what is your name")
print(phines_and_ferb)

Lecture 2 | Variables in Java | Input Output | Complete Placement Course

                                                                                 JAVA PROGRAMMING     public class Main { public static...