This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yarn | |
yarn test | |
near login | |
near dev-deploy | |
near deploy | |
near create-account a1.mhassanist.testnet --masterAccount mhassanist.testnet --initialBalance 1 | |
near deploy a1.mhassanist.testnet ./build/release/helloworld.wasm | |
near call a1.mhassanist.testnet writeSomething '{"message":"Hello Saleh", "toWho":"msaudi.testnet"}' --accountId mhassanist.testnet |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; | |
use near_sdk::collections::Vector; | |
use near_sdk::near_bindgen; | |
struct Writing { | |
pub text: String, | |
pub sender: String, | |
pub receiver: String, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//take an instance of the contract | |
let x: number; | |
//make sure the instance is properly created | |
beforeEach(() => { | |
x = 0; | |
}); | |
describe("add to x", () => { | |
it("add to x", () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//import your contract code | |
import { Contract } from "../assembly"; | |
//take an instance of the contract | |
let contract: Contract; | |
//make sure the instance is properly created | |
beforeAll(() => { | |
contract = new Contract(); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { PersistentVector, PersistentMap } from "near-sdk-core"; | |
@nearBindgen | |
class Organization { | |
name: string; | |
about: string; | |
orgId: string; | |
constructor(name: string, about: string, orgId: string) { | |
this.name = name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#DON'T just look at the code or copy it. Solve it yourself first | |
import turtle | |
rex = turtle.Turtle() | |
rex.color("green") | |
radius = int(input("Enter the radius of the circle: ")) | |
rex.circle(radius) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#assume no value for max and second max. | |
#You may also assume a very small numbers that u r sure will not be in the input data. | |
maximum = None | |
second_max = None | |
for i in range(5): | |
num = int(input('Enter a number: ')) | |
if i == 0: | |
maximum = num #consider the first number as the max |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Please follow the TODOs in the code to complete the project | |
''' | |
import turtle #use the turtle library | |
from tkinter import messagebox #tkinter liraray to show a message box | |
#Set the size of the main window. | |
turtle.setup(600,600) | |
#Window size is 600, so we have 300 pixels right and 300 pixels left in the coordinate system. | |
#(0,0) at the center. |