text
stringlengths
37
1.41M
"""Programa 6_3.py Descrição:Fazer um programa que percorra duas listas e gere uma terceira sem elementos repetidos Autor:Cláudio Schefer Data: Versão: 001 """ # Declaração de variáveis primeira = [] segunda = [] terceira = [] duas_listas = [] # Entrada de dados e Processamento while True: e = int(input(...
"""Programa 3_13.py Descrição:Escrever um programa que converta temperatura digitada em Cº em ºF. Autor:Cláudio Schefer Data: Versão: 001 """ # Declaração de variáveis # Entrada de dados temp_celsius = float(input("Digite temperatura em Celsius: ")) # Processamento temp_farenheit = ((9*temp_celsius)/5)+32 ...
"""Programa 8_1.py Descrição: Escrever uma função que retorne o maior de dois números. Autor:Cláudio Schefer Data: Versão: 001 """ # Declaração de variáveis a = int(0) b = int(0) # Entrada de dados a = int(input("Digite o valor de a: ")) b = int(input("Digite o valor de b: ")) # Processamento def máximo(a,b): ...
"""Programa 5_11.py Descrição: Escrever um programa que pergunte o depósito inicial e a taxa de juros de uma poupança. Exibir os ganhos mensais para os 24 primeiros meses. Exiba o total de ganhos para o período Autor:Cláudio Schefer Data: Versão: 001 """ # Declaração de variáveis depósito = float() taxa = float() n...
"""Programa 7_2.py Descrição: Escrever um programa que leia duas strings e que gere uma terceira com os caracteres em comum. Autor:Cláudio Schefer Data: Versão: 001 """ # Declaração de variáveis s1 = "" s2 = "" s3 = "" # Entrada de dados s1 = input("Digite a primeira string: ") s2 = input("Digite a segunda string...
"""Programa 5_6.py Descrição:Alterar o programa da listagem 5_9 para exibir os resultados no formato tabuada. Autor:Cláudio Schefer Data: Versão: 001 """ # Declaração de variáveis x = int(0) t = int(0) # Entrada de dados t = int(input("Digite qual tabuada deseja imprimir: ")) # Processamento x = 1 while x <= 10:...
"""Programa 8_4.py Descrição: Escrever uma função que receba a base e a altura de um triângulo e retorne sua área (base x altura / 2) Autor:Cláudio Schefer Data: Versão: 001 """ # Declaração de variáveis b = float() a = float() # Entrada de dados b = float(input("Digite o valor da base do triângulo: ")) a = float...
"""Programa 6_16.py Descrição:Rastrear o programa da listagem 6.44, mas em ordem decrescente. Autor:Cláudio Schefer Data: Versão: 001 """ # Declaração de variáveis L = [] x= int(0) fim = int(0) x = int(0) # é o índice da posição da lista, começando pela posição 0 e = int(0) # elementos da lista # Entrada de dados ...
#child class can has its own attributes and methods #we can extend few attributes of parent class using super keyword #parent class class Employee(): def __init__(self, name, age, salary): self.name = name self.age = age self.salary = salary def work(self): print(f"{self.name}...
# descripcion: Script Python que permite identificar el mayor de dos numeros ingresados por consola import os os.system("clear") print("ingrese primer numero: ") n1 = int(input()) n2 = int(input("ingrese segundo numero: ")) if n1 > n2 : print("El mayor es: ", n1) elif n1 < n2: print("el mayor es: ", n2)...
'''Validador de CPF''' while(1): cpf = input("Digite um CPF: ") cpfFiltrado = '' for i in cpf: if i == '.' or i == '-': continue else: cpfFiltrado += i cpfFiltrado = cpfFiltrado[:-2] print(cpfFiltrado) contador = 10 total = 0 ...
# Create a program that asks the user for a number and then prints out a list of all the divisors of that number. (If you don’t know what a divisor is, it is a number that divides evenly into another number. For example, 13 is a divisor of 26 because 26 / 13 has no remainder.) while True: num = int(input('Enter a ...
a = input("Enter first number: ") b = input("Enter second number: ") def doMath(x,y,z): x = int(x) y = int(y) if z == 1: return(str(x+y)) if z == 2: return(str(x-y)) if z == 3: return(str(x*y)) if z == 4: return(str(round(x/y,2))) if z == 5: return(...
import numpy as np from calculation_method import manhattan, euclid class Node: """ the node in a* algorithms shows the position and the father node """ def __init__(self, node_id, position): """ initialize the node-id and the position :param node_id: the number to mark the nod...
import numpy as np import matplotlib.pyplot as plt import sys class Runner(object): """ Runs algorithms and reports their performance in terms of number of iterations until convergence. """ def __init__(self, algs, env, run_count=50, interactive=False): self.algs = algs self.env = env...
import os # write a program that takes a name and last name seperated by comma and write the first name into # a file named the last name firstname = input("enter your first name: ") lastname = input("enter your last name: ") file = open(f"./devjoseph/week 3 assnm/{lastname}.txt", "w") file.write(firstname) file.clos...
# # bola = float(input("How many sweet did bola bring today?: ")) # # tolu = float(input("How many sweet did tolus bring today?: ")) # # obum = float(input("How many sweet did tolus bring today?: ")) # # how_many = int((bola + tolu + obum) // 3) # # how_many_R = int((bola + tolu + obum) % 3) # # print(f"bola gave her...
import random while True: input("Press enter to play dice: ") die1 = random.randint(1,6) die2 = random.randint(1,6) print(f"you rolled: {die1} : {die2}") if die1 == die2 == 6: print("Congratulations. you won") break else: print("Sorry, roll the dice again")
# a = 2 # b = 4 # m = a if a > b else b # print(m) # a = int(input("A: > ")) # b = int(input("B: > ")) # s = a if a < b else b # print(s) # cost_price = int(input("Enter cost price: ")) # selling_price = int(input("Enter lost price: ")) # profit = (selling_price - cost_price) / cost_price * 100 # lost = (cost_price...
# import random # wins= 0 # for i in range(100): # cards = ["c", "g", "g"] # collection of game possibilities # random_pick = random.randint(0,len(cards)-1) # pick a number within the range of the cards length # selected_card = cards[random_pick] # use the randomly picked number to access the cards list...
class Segment: def __init__(self, name, filename): self.name = name self.filename = filename self.text = [] self.next = None self.previous = None self.modified = False self.parameters = {} def __str__(self): return "[Segment %s/%s %s]" % (self.fil...
color = input("Write a Color: ") name = input("Write a Name: ") place = input("Write a Place: ") print(" ") print(f"I was travelling in {place} with {name}.") print(f"There we saw someone who was dressed in {color}")
# File: scrape_wiki.py # Description: A script that extracts HTML tables about the Sinclair Broadcast Group # Author: Dawid Minorczyk # Date: July 20 2017 # Command line argument import import os import sys import argparse # Data manipulation import import numpy as np import pandas as pd import csv...
from math import pi texte = ("Calcul du volume d'un cône" ) print(len(texte)* "-" ) print (texte) print(len(texte)* "_" ) h = float(input("Saisissez la hauteur (m) : ")) r = float(input("Saisissez le rayon (m) : ")) volCone = (pi * r**2 * h)/3.0 texte = ("Le volume du cône est de : " ) print(texte,round(volCone...
pi = 3.14 h = input() r = input() texte = "Calcul du volume d'un cône" print (texte) print(len(texte)* "_" )
import unittest from comparing_dna.sequence_alignment import min_number_of_coins class SequenceAlignmentTest(unittest.TestCase): def setUp(self): super(SequenceAlignmentTest, self).setUp() def tearDown(self): super(SequenceAlignmentTest, self).tearDown() def test_min_number_of_coins(se...
name=raw_input("Enter file name: ") if len(name)<1:name="mbox-short.txt" try: fname = open(name) except: print "this file is not exist!" quit() count=dict() for line in fname: line=line.rstrip() if line.startswith("From:"):continue if line.startswith("From"): word=line.split() ho...
# -*- coding:utf-8 -*- class SubtreeIndexError(ValueError): pass def Tree(data, *subtrees): l = [data] l.extend(subtrees) return l def is_empty_Tree(tree): return tree is None def root(tree): return tree[0] def subtree(treem, i): if i < 1 or i > len(tree): raise SubtreeIndexErro...
# -*- coding: utf-8 -*- import sqlite3 class DB: def __init__(self): self.connect = sqlite3.connect("test.db") self.cursor = self.connect.cursor() def searchTable(self, tableName): flag = False self.cursor.execute("SELECT name FROM sqlite_master WHERE type = 'table'") for item in self.cursor.fetchall(): ...
num = input('Enter four digit number: ') while (len(num) != 4 or num.isdigit() == False): num = input("It's not number, or number of digit is not four. Try again: ") num_mult = str(tuple(num)) num_mult = num_mult.replace("'","") num_mult = num_mult.replace(',','*') print('Multiplication of numbers:', eval(num_mu...
########################## Task 1 # n = int(input('Enter lenght of list: ')) # lst = [] # for i in range (n): # lst.append(int(input('Enter numer: '))) # print('Maximum: {}. Minimum: {}'.format(max(lst),min(lst))) ########################### Task 1.1 # lst = [int(input('Enter num: ')) for i in range(int(inpu...
# s.find(t) index of first instance of string t inside s (-1 if not found) # s.rfind(t) index of last instance of string t inside s (-1 if not found) # s.index(t) like s.find(t) except it raises ValueError if not found # s.rindex(t) like s.rfind(t) except it raises ValueError if not found #  s.join(text) combine the w...
from docx import Document # Creating a word file object doc = open('data/file.docx', 'rb') # creating word reader object document = Document(doc) # create an empty string and call this document. This document # variable store each paragraph in the Word document.We then # create a for loop that goes through each para...
age = input ('请输入你的年龄:') if int(age) == 30: print('kkk') print('ok') print('yes') print('可以成家') print('OVER') if int(age) != 30: print('failt')
# coding: utf-8 def is_palindromes(string): length = len(string) // 2 for i in range(length): if string[i] != string[-(i+1)]: return 'false' return 'true' s = input() print(is_palindromes(s))
# coding: utf-8 t = int(input()) for _ in range(t): s = input().split() result = float(s[0]) for i in range(1, len(s)): if s[i] == '@': result *= 3 elif s[i] == '%': result += 5 elif s[i] == '#': result -=7 print("{:.2f}".format(result))
# coding: utf-8 dic = {"000": "0", "001": "1", "010": "2", "011": "3", "100": "4", "101": "5", "110": "6", "111": "7"} number = input() while len(number) % 3: number = "0" + number result = "" for i in range(0, len(number), 3): key = number[i:i+3] result += dic[key] print(result)
# coding: utf-8 s = input() leng = len(s) l = [] for i in range(leng): l.append(s[i:]) l.sort() for c in l: print(c)
# coding: utf-8 from math import log, ceil n = int(input()) m = ceil(log(n//3, 2)) def make_triangle(triangle): result = [[" " for col in range(len(triangle[0])*2+1)] for row in range(len(triangle)*2)] x = (len(result[0])//2 - 1) - (len(triangle[0])//2 -1) y = len(triangle) z = len(triangle[0]) ...
# coding: utf-8 import sys write = sys.stdout.write read = sys.stdin.readline l = [] n = int(read()) for i in range(n): l.append(int(read())) l.sort() # 병합 정렬 #def merge_sort(a): # if len(a) <= 1: return a # half = len(a)//2 # left = merge_sort(a[:half]) # right = merge_sort(a[half:]) # mer = [] #...
# coding: utf-8 def count_char(char, string): string = ''.join(string) string = string.lower() print(char, string.count(char)) while True: string = input() if string == '#': break char, *string = string.split() count_char(char, string)
# coding: utf-8 def make_decimal(binary): result = 0 init = 23 for bit in binary: temp = int(bit) * (2 ** init) result += temp init -= 1 return result t = int(input()) for _ in range(t): digit = input() print(make_decimal(digit))
# coding: utf-8 def fibonacci(n): a, b, tmp = 0, 1, 0 for _ in range(n): tmp = a + b a = b b = tmp print(a) fibonacci(int(input()))
# coding: utf-8 numbers = list(map(int, input().split())) order = input() l = ["A", "B", "C"] numbers.sort() dic = {} for i in range(3): dic[l[i]] = numbers[i] for o in order: print(dic[o], end=" ")
# coding: utf-8 def biggest_prime(num): if num < 2: return 1 for i in range(2, int(num**0.5)+1): if not num % i: return num - (num / i) return num - 1 n = int(input()) print(int(biggest_prime(n)))
# coding: utf-8 n = int(input()) sequence = [1, 1, 1] for i in range(3, n): value = sequence[i-1] + sequence[i-3] sequence.append(value) print(sequence[n-1])
# coding: utf-8 def find_bit(num): result = [] num = list(bin(num)[2:]) num.reverse() for i in range(len(num)): if int(num[i]): result.append(i) for bit in result: print(bit, end=" ") t = int(input()) for _ in range(t): find_bit(int(input()))
# coding: utf-8 from itertools import permutations n, m = map(int, input().split()) numbers = map(int, input().split()) result = list(permutations(numbers, m)) result.sort() for r in result: r = map(str, r) print(' '.join(r))
# coding: utf-8 def say_yoda(words): result = words[2:] result += words[:2] return ' '.join(result) n = int(input()) for _ in range(n): string = input().split() print(say_yoda(string))
# coding: utf-8 n = int(input()) a = 0 b = 1 for i in range(n): tmp = b b = a + b a = tmp print(a)
# coding: utf-8 t = int(input()) coins = [25, 10, 5, 1] for _ in range(t): c = int(input()) result = [] for coin in coins: num = c // coin result.append(num) c -= num * coin for r in result: print(r, end=" ") print()
# coding: utf-8 def gcd(a, b): if not a % b: return b return gcd(b, a%b) n = int(input()) radius = list(map(int, input().split())) for i in range(1, n): gcd_value = gcd(radius[0], radius[i]) radius[i] = "{}/{}".format(radius[0]//gcd_value, radius[i]//gcd_value...
# coding: utf-8 n = int(input()) cards = [x for x in range(1, n+1)] while cards: print(cards.pop(0), end=" ") if cards: cards.append(cards.pop(0))
# coding: utf-8 def find(l, c): for i in range(len(l)): if c in l[i]: return i dial = ['ABC', 'DEF', 'GHI', 'JKL', 'MNO', 'PQRS', 'TUV', 'WXZY'] string = input() result = 0 for i in range(len(string)): result += find(dial, string[i]) + 3 print(result)
# coding: utf-8 h = input() fan = ':fan:' result = '{}:{}:{}'.format(fan, h, fan) print(fan * 3) print(result) print(fan * 3)
# coding: utf-8 n = int(input()) numbers = [] for _ in range(n): k = int(input()) numbers.append(k) for number in numbers: print('=' * number)
# coding: utf-8 n = int(input()) keys = ['PROBRAIN', 'GROW', 'ARGOS', 'ADMIN', 'ANT', 'MOTION', 'SPG', 'COMON', 'ALMIGHTY'] rank = [] for key in keys: top = max(map(int, input().split())) temp_dict = { 'name': key, 'point': top } rank.append(temp_dict) rank = sorted(r...
# coding: utf-8 x = int(input()) row = 0 col = 0 tem_row = 0 tem_col = 0 point = True for i in range(1, x): if tem_col == row and tem_row == 0: tem_col += 1 col = tem_col point = True elif tem_row == col and tem_col == 0: tem_row += 1 row = tem_row point = Fal...
#Python code to ask for name and print message #adding comment again name = input("Enter your name: ") print ("Hi " + name) print("Welcome to the git World") print("Nice to have you here") gender = input("Are you a Male/Female: ") if gender == "Male": print ("Hey Dude") elif gender == "Female": print("Hello lad...
import heapq class Solution: #Function to find the maximum number of activities that can #be performed by a single person. def activitySelection(self,n,start,end): heap = [] for i in range(n) : heapq.heappush(heap, (end[i], start[i])) pos = 0 coun...
# Google FooBar Challenge - Prison Labor Dodgers """ Prison Labor Dodgers ==================== Commander Lambda is all about efficiency, including using her bunny prisoners for manual labor. But no one's been properly monitoring the labor shifts for a while, and they've gotten quite mixed up. You've been given the ta...
def balanceHeaps(): ''' use globals min_heap and max_heap, as per declared in driver code use heapify modules , already imported by driver code Balance the two heaps size , such that difference is not more than one. ''' global min_heap, max_heap while len(min_heap) - len(max_heap) > 1 :...
def reverseWords(S): # code here s = S.split('.') s = s[::-1] return '.'.join(s) if __name__ == '__main__': t = int(input()) for i in range(t): s = str(input()) print(reverseWords(s))
class Solution: def dijkstra(self, V, adj, S): ''' Function to construct and return cost of MST for a graph represented using adjacency matrix representation ### Parameters * V: nodes in graph * adj: adjacency list for the graph * S: Source ''' ...
class Solution: def __init__(self) : self.store = set() def recurse(self, arr, n, stack) : if n == len(arr) : self.store.add(tuple(stack)) return self.recurse(arr, n+1, stack+[arr[n]]) self.recurse(arr, n+1, stack) #Function to f...
class Solution: def getPositions(self, i, j) : return ([ (i-1, j-1), (i-1, j), (i-1, j+1), (i, j-1), (i, j+1), (i+1, j-1), (i+1, j), (i+1, j+1) ]) def recursiveMark(self, i, j, marker) : #...
""" Not working for all test cases Fails : Input: 8 5 6 9 7 7 9 10 4 566 Its Correct output is: 85 And Your Code's output is: 84 """ class Solution: def recurse(self, arr, ind, k, cur_prod, store) : if cur_prod and cur_prod > k : return ...
""" This solution is similar to the egg drop problem. Uses Binary search in that manner. """ class Solution: # @param A : integer # @return an integer def sqrt(self, A): x = 0 base = 10**3 while base>0: while (x+base)**2<=A: x+= base base //= 2 return...
def max_of_subarrays(arr,n,k): ''' you can use collections module here. :param a: given array :param n: size of array :param k: value of k :return: A list of required values ''' temp = arr[:k] ma = 0 res = [max(temp)] for i in range(k, n) : temp = temp[1:] ...
#!/bin/python3 import math import os import random import re import sys # # Complete the 'almostSorted' function below. # # The function accepts INTEGER_ARRAY arr as parameter. # def isSorted(arr) : n = len(arr) for i in range(n-1) : if arr[i] > arr[i+1] : return False return True de...
class Solution: def isEqualTree(self, T, S) : if T is None and S is None : return True if T is None or S is None : return False if T.data != S.data : return False queue = [(T, S)] while len(queue) > 0 : ...
def split(n) : n1 = n // 2 n2 = n // 3 n3 = n // 4 if n1 > 10 : n1 = split(n1) if n2 > 10 : n2 = split(n2) if n3 > 10 : n3 = split(n3) return n1+n2+n3 n = int(input()) print(split(n))
""" Problem with Binary Search implementation """ class Solution: def __init__(self): self.store = {} # @param A : list of integers # @param B : integer # @param C : integer # @return an integer def solve(self, A, B, C, level=0): # If number of digits needed is zero, then w...
""" def calculateCapacitance(G) : capacitance = [] for i in range(1, len(G)) : capacitance.append(G[i] * G[i-1]) return capacitance def calculatePotential(G) : potential = [] for i in range(1, len(G)) : potential.append(G[i] - G[i-1]) return potential def calcula...
def traverse(heights, cur, green, red, noRed=False) : n = len(heights) - 1 while cur < n : if heights[cur] > heights[cur + 1] : # If the current height is more, then we cut it once red.append(heights[cur] - heights[cur + 1]) heights[cur] = heights[cur+1] ...
class Solution: def findHcf(self, a, b) : """ Given two numbers, returns their HCF """ if a < b : return self.findHcf(b, a) if b == 0 : return a return self.findHcf(b, a%b) def findTime(self, word) : """ Find...
class Node: def __init__(self, data): self.data = data self.next = None class MyQueue: def __init__(self) : self.head = None self.tail = None # Method to add an item to the queue def push(self, item): temp = Node(item) if se...
def serialize(root, A): queue = [root] while len(queue) > 0 : ptr = queue.pop(0) if ptr is None : A.append(-1) continue A.append(ptr.data) queue.append(ptr.left) queue.append(ptr.right) def deSerialize...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param A : head node of linked list # @return the first node in the cycle in the linked list def detectCycle(self, A): ptr1 = A ptr2 = A ...
class Solution: def generate(self, s, level, prev) : """ Utility function to generate and print IP address from given string. Parameters ---------- s - the remaining string left to create IP addresses level - the current level we are in, it ranges from 0 to 4 for I...
import collections import math import heapq class Solution: # A1[] : the input array-1 # N : size of the array A1[] # A2[] : the input array-2 # M : size of the array A2[] #Function to sort an array according to the other array. def relativeSort (self,A1, N, A2, M): a2_dict = dict...
class Solution: def __init__(self) : self.store_base3 = {} def convertToBaseThree(self, n) : """ Given a number returns its base 3 format """ if n in self.store_base3 : return self.store_base3[n] s = "" num = n while num > 0 : ...
def maxSubArraySum(a,size): summ = a[0] max_sum = summ for num in range(1, size) : summ = max(a[num], summ+a[num]) max_sum = max(max_sum, summ) return max_sum # At any point we have two options, either to start measuring the sum from the current number or to continue measuring the sum ...
import math class Solution: ##Complete this function #Function to swap odd and even bits. def swapBits(self,n): # Get all even bits of x even_bits = n & 0xAAAAAAAA # Get all odd bits of x odd_bits = n & 0x55555555 # Right shift even bits ...
'''Implement a class FIFO (First In First Out).''' from datetime import datetime class FirstInFirstOut: '''It should be a class with the following methods: push, pop, size, addition_time.''' def __init__(self) -> None: self.queue = [] def push(self, element) -> None: '''Add an element at ...
#!/usr/bin/python ''' Plot a learning curve for a regression model. Sample usage: python plot_learning_curve.py -m linear -l -v --features feature-sets/features1.cfg Run python plot_learning_curve.py --help for more information. ''' import os os.environ['MPLCONFIGDIR'] = '../' import numpy as np import matplotl...
#!/usr/bin/python import datetime from const import Const class Weather(object): ''' Abstraction class for the weather data set. Data includes the following metrics for each day in 2013: * AWND - Average daily wind speed (tenths of meters per second) * SNOW - Snowfall (mm) * TMIN -...
''' def add(a,b): try: c = a+b return c except: print("Error in adding two numbers") if(b == 0): exit() #y= int(input("Enter the number other than y")) def div(a,b): try: c = a/b return c except: print("You are trying to divide...
#import sys import os #sys.path.append("D:/") path = 'D:\Python\MJ1.txt' file_object = open(path,'r') for each in file_object: print(each) #file_read = file_object.read() #print(file_read) print("##################################") '''readt first 10 characters''' #character_10=file_object.read(10) #print(file_ob...
#Done by Carlos Amaral (20/07/2020) #Try 15.1- Cubes import matplotlib.pyplot as plt x_values = range(1, 5001) y_values = [x**3 for x in x_values] plt.style.use('seaborn') fig, ax = plt.subplots() ax.scatter(x_values, y_values, s=10) #Set chart title and label axes. ax.set_title("Square Numbers", fontsize = 24) a...
#Done by Carlos Amaral (25/07/2020) import json #Explore the structure of the data. filename = 'data/eq_data_1_day_m1.json' with open(filename) as f: all_eq_data = json.load(f) #1st, we import json module to load data from file and then store it in all_eq_data. readable_file = 'data/readable_eq_data.json' #Cre...
#Done by Carlos Amaral (22/07/2020) #Try 15.8 - Multiplication """When you roll two dice, you usually add the two numbers together to get the result. Create a visualization that shows what happens if you multiply these numbers instead. """ from plotly.graph_objs import Bar, Layout from plotly import offline from d...
import unittest from linkedlist import LinkedList from node import Node class TestLinkedList(unittest.TestCase): def setUp(self) -> None: self.linked_list = LinkedList() def test_insert(self): self.linked_list.insert(2, 3) self.assertEqual(len(self.linked_list), 1) self.assert...
def solution(phone_book): ''' 그냥 이중 for문으로 전체를 비교시 효율성이 떨어짐 비교를 줄일 수 있는 방법이 있을지 고민해보자 sort??? ''' answer = True phone_book.sort() for idx, phoneNum in enumerate(phone_book): if idx < len(phone_book)-1 and len(phoneNum) < len(phone_book[idx+1]): if phoneNum == phone_book[...
import numpy as np from math import exp, log from general_learning import predict import matplotlib.pyplot as plt def sigmoid(z): ''' The sigmoid function maps elements of z to discrete values in the [0,1] range. This property allows the classifier to treat the data points as probabilities and set a thres...
#========================================================================= # Author : Ed Friesema Date: 6/4/2017 # Goal :to make a simple text sungle player blackjack game'using OOP # #========================================================================= import random # Creates a Class for a deck of cards # M...
##################################################################### # Name : Sushanth Keshav # Topic : Implementing the learning process through my_neural_network # Programming Language : Python # Last Updated : 04.04.2020 ##################################################################### import numpy as np im...
import math import sys # from test_cases import TestSum def circle_inside_another_circle(c1, r1, c2, r2): """ Determines if a circle is inside of another circle. Parameters ---------- c1 : (x, y), center of circle 1. Tuple c2 : (x, y), center of circle 2. Tuple r1 : rad...
import json import os from util.const import Const class JsonUtil: ''' An utility class for json I/O operations. ''' @staticmethod def save(filename: str, data: object, sort_keys: bool = True) -> None: ''' @return None\n Just save `data` as a json file. ''' with open(f...
pineapples = int(raw_input('How many pineapples do you need?')) people = 10 result = pineapples * people print("You need {} pineapples".format(result))