CodePaste Logo
New Snippet New Recent Snippets Recent Snippets My Snippets My Snippets My Favorites Favorites Web Code Search Snippets Search
Sign inor Register
Format:
Recent Snippets
from math import pi,sin
def fx(a):
	if a<=0:
		x = 0
	elif  0<a<=1:
		x = (a**2) -a
	else:
		x = a**2 - sin(pi*a**2)
	print('X - ',x)
a = float(input('a - '))
Today @ 11:01am
Tags:
6 Views
no comments
 
def fx(a):
	if a<=0:
		x = 0
	elif  0<a<=1:
		x = a
	else:
		x = a**4
	print('X - ',x)
a = float(input('a - '))
fx(a)
Today @ 10:58am
Tags:
6 Views
no comments
 
def fx(a):
	if a<=2:
		x = a**2 + 4 * a + 5
	else:
		x = (1/a**2) + 4 * a +5 
	print('X - ',x)
a = float(input('a - '))
fx(a)
Today @ 10:56am
Tags:
7 Views
no comments
 
def fx(a):
	if 2<=a<2:
		x = a**2
	else:
		x = 4
	print('X - ',x)
a = float(input('a - '))
fx(a)
Today @ 10:52am
Tags:
6 Views
no comments
 
using System;

namespace randomnumberguessgame
{
    class Program
    {
        static int rastgeleSayi = 0;
        static int hak = 3;
        static int maksimumOlusabilecekSayi = 20;
        static Random rand = new Random();
Today @ 10:52am
Tags:
5 Views
no comments
 
def quadroTendey(a,b,c):
	discriminant = b**2 - 4*a*c
	print('Дискриминант - ',discriminant)
	if discriminant > 0:
		import math
		print('X1 = ',(-b + math.sqrt(discriminant)) / (2 * a))
		print('X2 = ',(-b - math.sqrt(discriminant)) / (2 * a))
	elif discriminant == 0:
		print('X = ',-b / (2 * a))
	else:
Today @ 10:49am
Tags:
6 Views
no comments
 
def quadroTendey(a,b,c):
	discriminant = b^2 - 4*a*c
	print('Дискриминант - ',discriminant)
	if discriminant > 0:
		import math
		print('X1 = ',(-b + math.sqrt(discriminant)) / (2 * a))
		print('X2 = ',(-b - math.sqrt(discriminant)) / (2 * a))
	elif discriminant == 0:
		print('X = ',-b / (2 * a))
	else:
Today @ 10:47am
Tags:
4 Views
no comments
 
def on(x,y,z):
	if x>9 and x<=99:
		x*=x
		print(x)
	if y>9 and y<=99:
		y*=y
		print(y)
	if z>9 and z<=99:
		z*=z
		print(z)		
Today @ 10:40am
Tags:
9 Views
no comments
 
var spiritVolumes = (from sv in _dbContext.SpiritVolumes
                     join b in _dbContext.Barrels on sv.BarrelID equals b.Id
                     where b.XferOutId == xfer.Id
                     select sv)
                    .Include(sv => sv.Barrel);

barrelsToUndo = (from sv in spiritVolumes
                 select sv.Barrel).ToList();
foreach(var bbl in barrelsToUndo)
{
Today @ 10:26am
Tags:
13 Views
no comments
 
[autoemploi@jobondemand autoemploi]$ git add .
[autoemploi@jobondemand autoemploi]$ git commit -m “update from server”
error: pathspec 'from' did not match any file(s) known to git.
error: pathspec 'server”' did not match any file(s) known to git.
[autoemploi@jobondemand autoemploi]$ git commit -m
error: switch `m' requires a value
usage: git commit [<options>] [--] <pathspec>...

    -q, --quiet           suppress summary after successful commit
Today @ 10:09am
Tags:
11 Views
no comments
 
def checkTriangle(x,y,z):
	if (x^2+y^2>z and z^2+y^2>x and x^2+z^2>y):
		print('Суйыр ушбурыш')
	else:
		print('Суйыр емес')	
x = int(input('a - ')) 
y = int(input('b - '))
z = int(input('c - '))
checkTriangle(x,y,z)
Today @ 10:08am
Tags:
13 Views
no comments
 
css
.ghx-swimlane-header .ghx-heading {
	margin: 0;
}
.ghx-swimlane-header .ghx-expander .ghx-iconfont {
	margin: 0!important;
}
#ghx-detail-view {
	width: 50%!important;
}
/*.ghx-column-headers,
Today @ 10:07am
Tags:
14 Views
no comments
 
< script type = 'text/javascript' >
	var _vwo_code = (function() {
		var account_id = 37026,
			settings_tolerance = 2000,
			library_tolerance = 2500,
			use_existing_jquery = false,
			// DO NOT EDIT BELOW THIS LINE
			f = false,
			d = document;
		return {
Today @ 10:00am
Tags:
12 Views
no comments
 
def on(x,y):
	if x<0 and y<0:
		x=abs(x)
		y=abs(y)
	elif (x>=0 and y>=0) and not 0.5<=x<=3 and not 0.5<=y<=3:
		x*=10
		y*=10
	if x<0:
		x+=0.5
	if y<0:
Today @ 9:59am
Tags:
12 Views
no comments
 
-- MySQL Workbench Forward Engineering

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';

-- -----------------------------------------------------
-- Schema prueba
-- -----------------------------------------------------

Today @ 9:56am
Tags:
12 Views
no comments
 
< script type = "text/rocketscript" >
	var _vwo_code = (function() {
		var account_id = 37026,
			settings_tolerance = 2000,
			library_tolerance = 2500,
			use_existing_jquery = false,
			// DO NOT EDIT BELOW THIS LINE
			f = false,
			d = document;
		return {
Today @ 9:54am
Tags:
12 Views
no comments
 
#include<stdio.h>
#include<math.h>
#include<string.h>
#define NUM_PEOPLE 6

int printTable(char name[][31], int age[], int n);
int removeDuplicates( char name[][31], int age[], int *n);

main()
{
Today @ 9:48am
Tags:
12 Views
no comments
 
def on(x,y,z):
	if x>9 and x<=99:
		print(x)
	if y>9 and y<=99:
		print(y)
	if z>9 and z<=99:
		print(z)		
x = int(input('x - ')) 
y = int(input('y - '))
z = int(input('z - '))
Today @ 9:39am
Tags:
12 Views
no comments
 
def z(x,y):
	if x==min(x,y):
		x=(x+y)/2
	elif y==min(x,y):
		y=(x+y)/2
	if x==max(x,y):
		x*=2
	elif y==max(x,y):
		y*=2
	print('x = ',x,' y = ',y)
Today @ 9:35am
Tags:
12 Views
no comments
 
def interval(x,y,z):
	if x in range(1,4):
		print('x in range 1 - 3')
	if y in range(1,4):
		print('y in range 1 - 3')
	if z in range(1,4):
		print('z in range 1 - 3')
x = int(input('x - ')) 
y = int(input('y - '))
z = int(input('z - '))
Today @ 9:27am
Tags:
13 Views
no comments
 
def z(x,y):
	if x>y:
		print(x)
	else:
		print(x,' ',y)
x = int(input('x - ')) 
y = int(input('y - '))
z(x,y)
Today @ 9:24am
Tags:
12 Views
no comments
 
#include <iostream>
#include <stdlib.h>
#include <time.h>

/* As cartelas de bingo são representadas por 3 linhas e 9 colunas.
porem cada cartela possui apenas 15 numeros preenchidos conforme o exemplo.
Os numeros vairam entre 1 e 100 e não se repetem sendo gerados em posições aleatorias em cada cartela crie um algoritmo que simule
uma cartela de bingo. seguindo os seguintes passos.
inicie a matriz com valor 0 em todas as posições. o valor 0 ira representar vazio */

by everton   Today @ 9:23am
Tags:
13 Views
no comments
 
def z(x,y):
	if x<=y:
		x=0
		print(x,' ',y)
	else:
		print(x,' ',y)
x = int(input('x - ')) 
y = int(input('y - '))
z(x,y)
Today @ 9:23am
Tags:
13 Views
no comments
 
def z(x,y):
	if x>y:
		print(x-y)
	else:
		print(y-x+1)
x = int(input('x - ')) 
y = int(input('y - '))
z(x,y)
Today @ 9:20am
Tags:
12 Views
no comments
 
x = input('a - ') 
y = input('b - ')
z = input('c - ')
if x<y<z:
	print('A<B<C', True)
else:
	print('A<B<C', False)
Today @ 9:15am
Tags:
13 Views
no comments
 
#Priklad 2
import random
lst = []
n = int(input())
for i in range(10):
    lst.append(random.randint(0,9))

pocet = 0;
for i in range(10):
    if(lst[i] == n):
by AdamisS   Today @ 9:03am
Tags:
14 Views
no comments
 
<!DOCTYPE html>
<html lang="pt-pt">
	<head>
		<meta charset="utf-8">
		<title>Exemplo 2 PHP</title>
	</head>
	<body>
		<?php
	       
		echo "Conversao de <br /br >";
by asd   Today @ 8:58am
Tags: asd
14 Views
no comments
 
강남식스 김대표 O1O_2568_4O7O 예약_견적문의 강남식스 예약 강남초원의집 문의 강남더킹 위치 강남벅시 견적 강남식스 소계 강남초원의집 수위 강남더킹 접대 강남식스 이벤트 강남 대표명소 강남식스 김대표 O1O↔2568↔4O7O
14 Views
no comments
 
강남벅시 김대표 O1O_2568_4O7O 예약_견적문의 강남벅시 예약 강남더킹 문의 강남초원의집 위치 강남식스 견적 강남벅시 소계 강남더킹 수위 강남초원의집 접대 강남식스 이벤트 강남 대표명소 강남벅시 김대표 O1O↔2568↔4O7O
14 Views
no comments
 
강남더킹 김대표  O1O_2568_4O7O 예약_견적문의 강남더킹 예약 강남벅시 문의 강남초원의집 위치 강남시그 견적 강남더킹 소계 강남벅시 수위 강남초원의집 접대 강남식스 이벤트 강남 대표명소 강남더킹 김대표 O1O_2568_4O7O
13 Views
no comments
 
#include<stdio.h>
void nhap ( int &a);
int KTSNT ( int a);
void xuat ( int q, int n);
void main()
{
   int a;
   nhap (a);
   int kt= KTSNT(a);
   xuat (kt ,a);
Today @ 8:33am
Tags:
16 Views
no comments
 
#include<stdio.h>
void nhap ( int &a);
int KTSNT ( int a);
void xuat ( int q, int n);
void main()
{
   int a;
   nhap (a):
   int kt= KTSNT(a);
   xuat (kt ,a);
Today @ 8:23am
Tags:
18 Views
no comments
 
//---------------------------//
//----------BEFORE-----------//
//---------------------------//

#include <stdio.h>
#include <deque>
#define ll long long
ll ary [2000000]={0};
ll sum [2000000]={0};
ll sum2[2000000]={0};
Today @ 8:11am
Tags:
23 Views
no comments
 
#include <stdio.h>
#define ull unsigned long long
char print[2][3][9]={{"#1 -> #3","#3 -> #2","#2 -> #1"},{"#1 -> #2","#2 -> #3","#3 -> #1"}};
int main(){
	int T;
	scanf("%d",&T);
	for(int i=1;i<=T;i++){
		ull n,l,r;
		scanf("%llu%llu%llu",&n,&l,&r);
		printf("Case #%d:\n",i);
Today @ 8:03am
Tags:
20 Views
no comments
 
#include <stdio.h>
#define M (int)(1e9+7)
#define mul(a,b) (((long long)a * (long long)b)%M)
#define add(a,b) (((long long)a + (long long)b)%M)
struct matrix{
	int a,b,c,d;
	matrix(int A,int B,int C,int D){
		a=A,b=B,c=C,d=D;
	}
	matrix operator*(matrix const& r){
Today @ 8:01am
Tags:
22 Views
no comments
 
#include<stdio.h>
void nhap ( int &a);
int KTSNT ( int a);
void xuat ( int q, int n);
void main()
{
   int a;
   nhap (a):
   int kt= KTSNT(a);
   xuat (kt ,a);
Today @ 8:00am
Tags:
24 Views
no comments
 
#include <stdio.h>
#define M (int)(1e9+7)
int main(){
	int DP[10001]={1,0},n,target,c;
	scanf("%d%d",&n,&target);
	while(n--){
		scanf("%d",&c);
		for(int i=c;i<=target;i++)
			DP[i] = ( DP[i] + DP[i-c] ) %M;
	}
Today @ 7:59am
Tags:
22 Views
no comments
 
const API_URL = {
  'production': JSON.stringify('https://localhost:4001'),
  'development': JSON.stringify('https://eligram-dev.herokuapp.com/api')
};

const WS_URL = {
  'production': JSON.stringify('wss://eligram.herokuapp.com/socket'),
  'development': JSON.stringify('wss://eligram-dev.herokuapp.com/socket')
};

Today @ 7:24am
Tags:
27 Views
no comments
 
강남 초원의집 김대표  O1O_2568_4O7O 예약_견적문의 강남 초원의집 예약 강남더킹 문의 강남벅시 위치 강남식스 견적 강남초원의집 소계 강남더킹 수위 강남벅시 접대 강남식스 이벤트 강남 대표명소 강남 초원의집 대표 O1O_2568_4O7O
28 Views
no comments
 
from PIL import Image, ImageDraw

class canvas:
    def __init__(self, width, height, filler):
        self.width = width
        self.height = height
        size = [width, height]
        self.backingImage =Image.new('RGB', size, (255, 255, 255))
        self.drawer = ImageDraw.Draw(self.backingImage)
 
Today @ 6:42am
Tags:
35 Views
no comments
 
import hudson.node_monitors.*
import jenkins.model.*

for (node in Jenkins.instance.nodes) {
    def computer = node.toComputer()
    if (computer.getChannel() == null) continue

    def rootPath = node.getWorkspaceRoot()
    def space = DiskSpaceMonitor.DESCRIPTOR.get(computer)

by Moritz   Today @ 6:32am
Tags:
36 Views
no comments
 
from PIL import Image, ImageDraw

class canvas:
    def __init__(self, width, height, filler):
        self.width = width
        self.height = height
        size = [width, height]
        self.im =Image.new('RGB', size, (255, 255, 255))

 
Today @ 5:31am
Tags:
46 Views
no comments
 
<script type="text/javascript" id="pap_x2s6df8d" src="https://studentkortet.postaffiliatepro.com/scripts/hd1vjqh5"></script>
<script type="text/javascript">
(function () {
function getCookie (name) {
  var value = new RegExp(name + "=([^;]+)").exec(document.cookie);
  return value ? unescape (value[1]) : null;
}
// PRISJAKT
  var prisjaktCookie = getCookie('pjref');
  if (prisjaktCookie) {
Today @ 5:03am
Tags:
46 Views
no comments
 
from PIL import Image, ImageDraw

class canvas:

    def __init__(self, width, height, filler):
        self.width = width
        self.height = height
        self.a = [[filler for i in range(self.width)] for j in range(self.height)]
        self.filler = filler
        size = [width, height]
Today @ 5:01am
Tags:
48 Views
no comments
 
class UpdateGiftMessagesContent < ActiveRecord::Migration
  def up
    TextChat::Message.where('content like ?', '::gift::%').find_each do |message|
      new_content = message.content.gsub(/::gift::(\d+)::/, '::gift::\1::0.1::')
      message.update_column(:content, new_content)
    end
  end

  def down
    TextChat::Message.where('content like ?', '::gift::%').find_each do |message|
Today @ 4:45am
Tags:
54 Views
no comments
 
class AddCommissionRateToGifts < ActiveRecord::Migration
  def up
    add_column :gifts, :commission_rate, :decimal, precision: 3, scale: 2

    Gift.find_each do |gift|
      gift.update_column(:commission_rate, 0.1)
    end
  end

  def down
Today @ 4:44am
Tags:
50 Views
no comments
 
у меня есть дикт такой 
messagesDict = Dictionary<User, [Message]> ()

но если сделать
 messagesDict[user] = [Message]()                 messagesDict[user]?.append(message)

и потом попробовать напечатать что там 
print(MessagesTableViewController.messagesDict[user])

то выдает 
Today @ 3:52am
Tags:
57 Views
no comments
 
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class Flower : MonoBehaviour
{
	public float honeyAmount;
	public float maxHoneyAmount;
	bool transferringToPlayer;
	float transferRate;
by Alex   Yesterday @ 12:17pm
Tags:
73 Views
no comments
 
xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:universal="http://schemas.android.com/apk/res-auto">

    <item
        android:id="@+id/settings"
        universal:showAsAction="never"
        android:title="@string/settings" />


by wirtual   Friday @ 1:38am
Tags:
221 Views
no comments
 
xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <group android:checkableBehavior="single" android:id="@+id/main_group">

    </group>

</menu>
by wirtual   Friday @ 1:38am
Tags:
226 Views
no comments
 
brought to you by:
West Wind Techologies