Skip to content

Instantly share code, notes, and snippets.

# basic quiz app - one question
print("Welcome to the Quiz App!")
print("Please answer the following questions:")
print("1. What is the capital of India?")
answer = input("Your answer: ").strip().lower()
if answer == "new delhi":
print("Correct!")
else:
number = 7
print("Welcome to the Guessing Game!")
guess = int(input("Guess a number between 1 and 10: "))
if guess == number:
print("Yay! You guessed it right!")
else:
print("Oops! Wrong guess")
@shinysu
shinysu / 01_rps.py
Last active June 25, 2025 09:04
rock, paper, scissor
# This is a simple Rock, Paper, Scissors game in Python
# where the computer's choice is fixed to "rock" for demonstration purposes.
#
# print, if-elif-else, input, and string comparison
computer_choice = "rock"
print('--' * 17)
print("Welcome to Rock, Paper, Scissors!")
print('--' * 17)
@shinysu
shinysu / 01_mark.py
Last active June 24, 2025 11:57
student_marksheet
# Get the marks of a student and print the result based on the marks.
# getting input, print, functions, conditionals
def pass_or_fail(marks):
if marks >= 40:
return "Pass"
else:
return "Fail"
name = input("Enter the student's name: ")
marks = int(input(f"Enter marks for subject {i + 1}: "))
@shinysu
shinysu / bot.py
Last active February 12, 2022 13:26
webPageAnalyzer
import PySimpleGUI as sg
from utils import get_statistics
layout = [
[sg.Text("Enter the URL: ", font=('Arial','16')),
sg.Input("", font=('Arial','16'), size=(40,1), key='url'),
sg.Button("Get Data", font=('Arial','16'), key='get')],
[sg.Multiline("", font=('Arial','16'), size=(70, 15), key='output')]
]
from random import randint
num = randint(1, 10)
guess = None
while guess != num:
guess = input("guess a number between 1 and 10: ")
guess = int(guess)
if guess == num:
@shinysu
shinysu / game09.py
Created September 21, 2021 10:18
one enemy
'''
One enemy
'''
import pgzrun
from random import randint
WIDTH = 800
HEIGHT = 600
tank = Actor('tank_blue')
tank.bottom = HEIGHT
@shinysu
shinysu / game.py
Created September 21, 2021 09:54
gist 3
import pgzrun
WIDTH = 800
HEIGHT = 600
tank = Actor('tank_blue')
tank.bottom = HEIGHT
tank.x = WIDTH / 2
tank.angle = 90
def draw():
@shinysu
shinysu / game.py
Created September 21, 2021 09:54
gist 3
import pgzrun
WIDTH = 800
HEIGHT = 600
tank = Actor('tank_blue')
tank.bottom = HEIGHT
tank.x = WIDTH / 2
tank.angle = 90
def draw():
@shinysu
shinysu / game.py
Created September 21, 2021 09:36
gist2
import pgzrun
WIDTH = 800
HEIGHT = 600
tank = Actor('tank_blue')
tank.bottom = HEIGHT
tank.x = WIDTH / 2
tank.angle = 90
def draw():