All New

user:thomas gists created by user

title:mygist gists with given title

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

Login


All New
's Avatar

kristofer

Joined 1714567308

Recently created
Least recently created
Recently updated
Least recently updated
All gists 108
kristofer's Avatar

kristofer / Python Alarm

0 likes
0 forks
1 files
Last active 1739982656
1 from datetime import datetime
2 from playsound import playsound
3 alarm_time = input("Enter the time of alarm to be set:HH:MM:SS\n")
4 alarm_hour=alarm_time[0:2]
5 alarm_minute=alarm_time[3:5]
6 alarm_seconds=alarm_time[6:8]
7 alarm_period = alarm_time[9:11].upper()
8 print("Setting up alarm..")
9 while True:
10 now = datetime.now()
kristofer's Avatar

kristofer / Acronym Python

0 likes
0 forks
1 files
Last active 1739982535
user_input = str(input("Enter a Phrase: "))
text = user_input.split()
a = " "
for i in text:
    a = a+str(i[0]).upper()
print(a)
kristofer's Avatar

kristofer / Acronym Python

0 likes
0 forks
1 files
Last active 1739982565
user_input = str(input("Enter a Phrase: "))
text = user_input.split()
a = " "
for i in text:
    a = a+str(i[0]).upper()
print(a)
kristofer's Avatar

kristofer / Linear Search Java

0 likes
0 forks
1 files
Last active 1739971512
public class LinearSearch {
    // Method that performs linear search
    public static int linearSearch(int[] array, int target) {
        // Iterate through each element in the array
        for (int i = 0; i < array.length; i++) {
            // If current element matches target, return its index
            if (array[i] == target) {
                return i;
            }
kristofer's Avatar

kristofer / ifsloopspy.md

0 likes
0 forks
1 files
Last active 1739908233
deepseekr1

if statements and loops : the building blocks of your programming

Here’s a concise explanation of if statements and loops in Python that might serve as an introductory overview:

Introduction to If Statements and Loops

Python is a programming language that uses control structures like if statements, loops, and conditional expressions. These constructs allow programmers to make decisions or perform repetitive tasks based on certain conditions.

What are If Statements?

kristofer's Avatar

kristofer / Java Strings Intro

0 likes
0 forks
1 files
Last active 1739827712
Basic Intro to Java String class.

Working with Strings in Java

String Creation and Basics

Strings are immutable objects in Java. Here are different ways to create them:

public class StringBasics {
    public static void main(String[] args) {
        // String creation
kristofer's Avatar

kristofer / Java Intro level 0

0 likes
0 forks
1 files
Last active 1739827436
Very VERY Basic Introduction to Java Programming

VERRRRRRY Basic Introduction to Java Programming

1. Basic Program Structure

Every Java program starts with a class, and the main method is the entry point of the program. Here's a simple example:

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
kristofer's Avatar

kristofer / Java Control Flow: If Statements and Loops

0 likes
0 forks
1 files
Last active 1739827093
Java Control Flow: If Statements and Loops

Java Control Flow: If Statements and Loops

If Statements

Basic If Statement

The simplest form of decision making:

public class BasicIf {
    public static void main(String[] args) {
kristofer's Avatar

kristofer / Vars, Ops and Types

0 likes
0 forks
1 files
Last active 1739827005
Java Variables, Operators, and Types

Java Variables, Operators, and Types

Primitive Data Types

Java has eight primitive data types that store simple values. Here's a comprehensive overview:

public class PrimitiveTypes {
    public static void main(String[] args) {
        // Integer types
        byte smallNumber = 127;          // 8-bit, range: -128 to 127
kristofer's Avatar

kristofer / Jshell Snippets 1

0 likes
0 forks
1 files
Last active 1738782502
1 List<String> list1 = new ArrayList<>();
2 list1.add("Kristofer");
3 // new Scanner(System.in).next();
4 // input("Howdy");
5
6
7 String input(String prompt) {
8 System.out.print(prompt+" ");
9 var sc = new Scanner(System.in);
10 return sc.next();
Newer Older

Powered by Opengist ⋅ Load: 136ms⋅

English
Čeština Deutsch English Español Français Magyar Português Русский 中文 繁體中文