Skip to content

Instantly share code, notes, and snippets.

# assumed user balance
user_balance = 1234.55
# assumed user password
user_password = "!2A34"
print("Welcome to Trusted Bank ATM")
print("1. Withdraw")
print("2. Exit")
import unittest
from main import *
class TestCountFileLines(unittest.TestCase):
def test_file_line_count(self):
self.assertEqual(line_count(filename='README.md', lookup_value=''), 77)
def test_file_line_count_with_optional_argument(self):
self.assertEqual(line_count(
# Simple Snake Game in Python 3 for Beginners
# By @TokyoEdTech
import turtle
import time
import random
delay = 0.1
# Score
@mhassanist
mhassanist / main.py
Last active December 7, 2022 15:24
from turtle import *
color('red', 'yellow')
begin_fill()
while True:
forward(200)
left(170)
if abs(pos()) < 1:
break
end_fill()
# Simple Snake Game in Python 3 for Beginners
# By @TokyoEdTech
import turtle
import time
import random
delay = 0.1
# Score
# import required modules
import requests, json
# Enter your API key here
api_key = "10562986aab4aacd5e1a4e38a655f13b"
# base_url variable to store url
base_url = "http://api.openweathermap.org/data/2.5/weather?"
# Give city name
Simplified Table Tennis Game Rules:
- The game has 2 players or 4 players (2 teams of 2).
- The objective is to hit the ball in such a way that the opponent is not able to return it. Points are awarded to the player or team who succeeds in that.
- One team starts serving. The ball must only touch each table side once after each hit.
- The first player or team to reach 11 points with a lead of at least 2 points wins the game.
—> Make a program that manages the game by keeping track of the awarded points. When the game ends, it should announce the winner.
—> With your team, decide what objects (attributes and methods) are needed to develop this program.
class Product:
def __init__(self, name, price):
self.name = name
self.price = price
class Cart:
def __init__(self):
self.items = []
def add_item(self, product):
import 'dart:async';
import 'dart:io';
import 'dart:typed_data';
import 'package:camera/camera.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:filesize/filesize.dart';
import 'package:flutter/material.dart';
import 'package:geocoding/geocoding.dart';
class OperationCounterNumericProcessor(NumericProcessor):
def __init__(self, computations_list):
super().__init__(computations_list)
self.count_operations = {}
def run_one_computation(self, computation):
operation = computation["operation"]
if operation not in self.count_operations:
self.count_operations[operation] = 1
else: