Uploaded July 2024 | Updated September 2026, 2 weeks ago
#pythontutorial #python #pythonprogramming
#Python PushButtons
import sys
from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton, QLabel
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setGeometry(700, 300, 500, 500)
self.button = QPushButton("Click me!", self)
self.initUI()
def initUI(self):
self.button.setGeometry(150, 200, 200, 100)
self.button.setStyleSheet("font-size: 30px;")
self.button.clicked.connect(self.on_click)
def on_click(self):
print("Button clicked!")
if __name__ == '__main__':
app = QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec_())
#pythontutorial #python #pythonprogramming
#Python PushButtons
import sys
from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton, QLabel
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setGeometry(700, 300, 500, 500)
self.button = QPushButton("Click me!", self)
self.initUI()
def initUI(self):
self.button.setGeometry(150, 200, 200, 100)
self.button.setStyleSheet("font-size: 30px;")
self.button.clicked.connect(self.on_click)
def on_click(self):
print("Button clicked!")
if __name__ == '__main__':
app = QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec_())







![Lets code a WEIGHT CONVERTER in Java! ๐๏ธ
#java #javatutorial #javacourse
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// WEIGHT CONVERSION PROGRAM
Scanner scanner = new Scanner(System.in);
double weight;
double newWeight;
int choice;
System.out.println(Weight Conversion Program);
System.out.println(1: Convert lbs to kgs);
System.out.println(2: Convert kgs to lbs);
System.out.print(Choose an option: );
choice = scanner.nextInt();
if(choice 1){
System.out.print(Enter the weight in lbs: );
weight = scanner.nextDouble();
newWeight = weight * 0.453592;
System.out.printf(The new weight in kgs is: %.2f, newWeight);
}
else if(choice 2){
System.out.print(Enter the weight in kgs: );
weight = scanner.nextDouble();
newWeight = weight * 2.20462;
System.out.printf(The new weight in lbs is: %.2f, newWeight);
}
else{
System.out.println(That was not a valid choice);
}
scanner.close();
}
} Lets code a WEIGHT CONVERTER in Java! ๐๏ธ](https://i.ytimg.com/vi/DFhpzaEOoxs/mqdefault.jpg)

![Learn Java Object Oriented Programming in 10 minutes! ๐งฑ
#java #javatutorial #javacourse
public class Main {
public static void main(String[] args) {
// Object = An entity that holds data (attributes)
// and can perform actions (methods)
// It is a reference data type
Car car = new Car();
System.out.println(car.make);
System.out.println(car.model);
System.out.println(car.year);
System.out.println(car.price);
System.out.println(car.isRunning);
car.drive();
car.brake();
}
}
public class Car {
String make = Ford;
String model = Mustang;
int year = 2025;
double price = 58000.99;
boolean isRunning = false;
void start(){
isRunning = true;
System.out.println(You start the engine);
}
void stop(){
isRunning = false;
System.out.println(You stop the engine);
}
void drive(){
System.out.println(You drive the + model);
}
void brake(){
System.out.println(You brake the + model);
}
} Learn Java Object Oriented Programming in 10 minutes! ๐งฑ](https://i.ytimg.com/vi/DYbi93vuSaU/mqdefault.jpg)
