text
stringlengths
37
1.41M
class Product(object): def __init__(self, price, name, weight, brand): self.price = price self.name = name self.weight = weight self.brand = brand self.status = "for sale" def sell(self): self.status = "sold" return self def add_tax(self, tax_rate): ...
name = ["Anna", "Eli", "Pariece", "Brendan", "Amy", "Shane", "Oscar"] favorite_animal = ["horse", "cat", "spider", "giraffe", "ticks", "dolphins", "llamas"] def makeDict(list1, list2): if len(list1) > len(list2) or len(list1) == len(list2): key_list = list1 val_list = list2 else: key_l...
# input word_list = ['hello','world','my','name','is','Anna'] char = 'o' # output new_list = [] for val in range(len(word_list)): if word_list[val].find(char) > -1: new_list.append(word_list[val]) print new_list
import argparse parser = argparse.ArgumentParser(description='XOR string with key') parser.add_argument("-s", "--string", help="String to encrypt", required=True, action="store") parser.add_argument("-k", "--key", help="Encryption key", required=True, action="store") args=parser.parse_args() plaintext=bytearra...
import argparse from string import ascii_lowercase, ascii_letters, printable, punctuation parser = argparse.ArgumentParser(description='Decrypt string XORed with single letter') parser.add_argument("-s", "--string", help="String to decrypt", required=True, action="store") args=parser.parse_args() bytesarray=by...
#!/usr/bin/env python # -*- coding: utf-8 -*- import cv2 import numpy as np def create_blank(width, height, rgb_color=(0, 0, 0)): """Create new image(numpy array) filled with certain color in RGB""" # Create black blank image image = np.zeros((height, width, 3), np.uint8) # Since OpenCV uses BGR, con...
''' setattr:设置属性(动态获取某个属性的函数) setattr(对象或者类,属性名称,赋值的新值) setattr 不管属性存在不存在,都会赋给新值 ''' class Phone: property = True def __init__(self,brand): self.brand = brand def call(self): self.xianren = "男" print("使用老年机正在打电话") def send_short_messages(self): print('使用老年机正在发送短信') i...
def word_ending_by_number(number :int) -> str: number = abs(number) if number in range(11, 20): return 'ов' x = number % 10 if x == 1: return '' elif x in range(2, 5): return 'а' else: return 'ов'
import tkinter as tk from tkinter import * import os root = tk.Tk() root.title("PROJECT ON RECOMMENDED SYSTEM") root.configure(bg='sky blue') #canvas = canvas(root, bg = "blue", height=100, width=100) #canvas.grid(row=0,column=2) #C = tkinter.Canvas(root, bg="blue", height=250, width=300) canvas = tk.Canvas(root) #c...
def print_sum(a): if a == 1: return 1 else: return a*print_sum(a-1) n = print_sum(5) print(n)
def print_q(y): if y%400 == 0 or y%4 == 0 and y%100 != 0: print("%d是润年"%y) else: print("不是润年") y = int(input("输入年号")) print_q(y)
import trade graph={ "numAttrs":["initialPrice","price","highestPrice","lowestPrice","average","relativePrice","margin"], "coin":"", "initialPrice":0, "price":0, "highestPrice":0, "lowestPrice":0, "average":0, "relativePrice":0, "margin":0 } global clearCanvas clearCanvas=True def clear(): for attr in grap...
import requests import json # This is an example of creating a request with mashivisor Real Estate API # HTTP requests just work like opening a webpage, think about what data a webpage displays when it loads, you're just taking that data when you do requests # Define data you want to send in a request as variables a...
# all variables are reference types, x point to object "5" which is primitive type x = 5 # in this case 5 will be garbage collected x = 10 # both x and y will be pointing tot he same integer objects x = 5 y = 5 # this returns true as both x and y point to the same value print(x==y) s1 = "hello" s2 = "hello" # thi...
# in operator #it can be applied in list, dictionary, Tuples, and strings my_list = [1, 3, 4, 5, 6] my_dict = {"S": "Small", "M": "Medium", "L": "Large", "XL": "X-Large"} my_tuple = (10, 13, 15, 17, 11) name = "Elvis Presley" list_included = 1 in my_list dict_included = "S" in my_dict tup_included = 11 in my_tuple st...
person = {'name': 'Peter', 'age': 29} person['city'] = 'Cape Town' print person print person['name'] del person['city'] print person states = { 'Oregon': 'OR', 'Florida': 'FL', 'California': 'CA', 'New York': 'NY', 'Michigan': 'MI', } cities = { 'OR':'Portland', 'FL':'Jacksonville', 'CA':'San Francisco', ...
def isPalindrome(s): r = ''.join(reversed(list(s))) print(s,r) return s == r s = input() print(isPalindrome(s))
# CB 2020-10-02 Palindrome String Checker # CB 2020-10-02 Take in a string as input def stringInput(): originalString = input("Please input a string: ") return originalString # CB 2020-10-02 Reverse the string, store it def reverse(originalString): newString = "" index = len(originalString) - 1 ...
print("hello user welcome to my addtion program") num1 = int(input("Please enter first number : ")) num2 = int(input("Please enter second number : ")) sum_of_nums = num1 + num2 print(sum_of_nums) input()
""" The following code is for the trivia bot found on the JakeMac discord server. This is the piece of code that interacts with the actual discord server. Pretty much the front end of it. Author: Kenny Blake 2/14/18 """ import discord from discord.ext import commands import trivia answered = 0 client = commands.Bo...
#Queue Class that takes a max size as a parameter and will only enqueue items up to that max size indicated class Queue: def __init__(self, MAX_SIZE): self.queue = [] self.MAX_SIZE = MAX_SIZE # create an empty queue def create_queue(self): return [] # return the size of the li...
import random import string def randomString(stringLength=60): """Generate a random string of fixed length """ letters = string.ascii_lowercase return ''.join(random.choice(letters) for _ in range(stringLength)) def randomAlphanumeric(stringLength=60): return ''.join( random.choice(string.as...
# written by Matt Borthwick for "Data Exploration in Python" presentation, Jan 17, 2018 from _csv import reader import matplotlib.pyplot as plt import numpy as np # exapmle usage: # # from explorer import FakeDataExplorer # ex = FakeDataExplorer("fake-data.csv") # print(ex.keys()) # ex.histograms("revenue") # ex...
"""Functions for creating a co-citation graph. A co-citation graph is a semantic similarity measure which ranks documents commonly cited together by other documents [1]_. It provides a forward looking assesment on how similar two documents are, as opposed to the retrospective approach of the citation network. Refere...
from math import hypot oposto = float(input('Qual o comprimento do cateto \033[35moposto\033[m? ')) adjacente = float(input('Qual o comprimento do cateto \033[35madjacente\033[m? ')) hipotenusa = hypot(oposto,adjacente) print('a hipotenusa vai medir \033[36m{:.2f}'.format(hipotenusa))
reais=float(input('Quantos reais você tem? R$')) dol=4.33 print('Com {:.2f} você possui US${:.2f}'.format(reais,reais/dol)) real=float(input('Quantos dólares você tem? US$')) print('Neste caso você possui R${:.2f} reais'.format(real*dol))
from random import randint from time import sleep from operator import itemgetter jogos = {'jogador1' : randint(1,6), 'jogador2' : randint(1,6), 'jogador3' : randint(1,6), 'jogador4' : randint(1,6)} ranking = [] print('Valores sorteados:') for k, v in jogos.items(): print(f' O {k} tirou {...
times = ('Athletico', 'Fortaleza', 'Bragantino', 'Palmeiras', 'Atlético-MG', 'Fluminense', 'Bahia', 'Santos', 'Flamengo', 'Corinthians', 'Ceará', 'Internacional', 'Juventude', 'Chapecoense') print('-='*30) print('Classificação Brasileirão') print('-='*30) print(f'Os 5 primeiros colocados são {time...
data = {} gols = [] data['nome'] = str(input('Nome do Jogador: ')) partidas = int(input(f'Quantas partidas {data["nome"]} jogou? ')) for g in range(0, partidas): gols.append(int(input(f'Quantos gols na partida {g+1}? '))) data['gols'] = gols[:] data['total'] = sum(gols) print(data) print('-='*20) print(f'O campo no...
resp = "Y" sum = quant = average = bigger = smaller = 0 while resp in 'Yy': num = int(input('Say a number: ')) sum += num quant += 1 if quant == 1: bigger = smaller = num else: if num > bigger: bigger = num if num < smaller: smaller = num resp = st...
from math import radians, cos, sin, tan angulo = float(input('Digite o ângulo que você deseja ' )) seno = sin(radians(angulo)) print('O ângulo {} tem o seno de {:.2f}'.format(angulo,seno)) cosseno = cos(radians(angulo)) print('O ângulo {} tem o cosseno de {:.2f}'.format(angulo,cosseno)) tangente = tan(radians(angulo)) ...
cidade = str(input('Digite o nome da sua cidade: ')).strip().split() print(cidade[0].lower() =='santo')
n1=int(input('Diga um número:')) dob=n1*2 trip=n1*3 raiz=n1**(1/2) print('O dobro de {} é: {}. \nO triplo é: {}. \nE a raíz quadrada é: {}.'.format(n1,dob,trip,raiz))
valores = [] impares = [] pares = [] while True: valores.append(int(input('Digite um número: '))) quest = str(input('Deseja continuar?[S/N] ')) if quest in 'nN': break elif quest not in 'nNsS': quest = str(input('Digite S ou N: ')) for i, v in enumerate(valores): if v % 2 == 0: ...
num = int(input('\033[36mDigite um número inteiro:\033[m ')) decidir = int(input( '\033[36mEscolha qual será a base de conversão:\033[m \n\033[31mdigite [1] para binário\033[m\n\033[32mdigite [2] para octal\033[m\n\033[34mdigite [3] para hexadecimal:\033[m ')) if decidir == 1: print('\033[31mconvertendo {} par...
import os.path import tempfile class File: def __init__(self, path_to_file): self.path_to_file = path_to_file if not os.path.exists(path_to_file): with open(self.path_to_file, "a") as f: f.write('') file_in_next = open(self.path_to_file, "r") self.file_in...
def jHex(word): jap = list(word) List = [] for i in jap: if i == " ": List.append("9940") elif i == ",": List.append("9941") elif i == ".": List.append("9942") elif i == "・": List.append("9943") elif i == ":": ...
import math import time import random import csv def main(start=10, step=10, count=2000): with open('quicksort.csv', mode='w') as csv_file: fieldnames = ['items_coutn', 'time_to_run'] writer = csv.DictWriter(csv_file, fieldnames=fieldnames) n = start for i in range(count): print("run fo n: %d" ...
tupler = lambda x,y: (x, y) def cons(a, b): def pair(f): return f(a, b) return pair def car(pair): return pair(tupler)[0] def cdr(pair): return pair(tupler)[1] print(car(cons(3,4))) print(cdr(cons(3,4)))
def general_fibonacci(n, X): cache = [0 for _ in range(n + 1)] cache[0] = 1 for i in range(n + 1): cache[i] += sum(cache[i - x] for x in X if i - x >= 0) return cache[-1] def fibonacci(n): return general_fibonacci(n-1, {1,2}) if __name__ == "__main__": print(f"fibonacci(10) = {fibona...
# Class to do add IDD codes to phone numbers that don't have them. # Part of, https://github.com/johntelforduk/shopify-to-facebook import json class PhoneCode: def __init__(self): code_file = open('International-Dialing-Codes/dialing-codes-data') code_json = (code_file.read()) code_file...
# %% # Essentially, Python is an object oriented programming language. Hence, everything in Python is pretty much an object # with it's own methods. # First some definitions. # An object is simply a collection of data (variables) and methods (functions) that act on said data. # A class is essentially a blueprint for sa...
# %% # assign magicNumber and inputNumber an integer value # try changing them and see what happens magicNumber = 10 inputNumber = 10 # if statements evaluate the expression after it. # if the expression is true, then the code under it runs. if inputNumber == magicNumber: print(str(inputNumber) + " is the magic nu...
# Printing any number print(490) # Printing any string print("Hi") ############################################### End ######################################## # 1. Print any number value ? # 2. Print any string value ?
from perceptron import Perceptron import matplotlib.pyplot as plt f = lambda x:x class LinearUnit(Perceptron): def __init__(self, input_num): Perceptron.__init__(self, input_num, f) def get_training_dataset(): input_vecs = [[5], [3], [8], [1.4], [10.1]] labels = [5500, 2300, 7600, 1800, 11400] ...
def UpperCase(string): str = string.upper() print(str) x = 'Hello World' y = 'hello world' z = 'hELLO wORLD' UpperCase(x) UpperCase(y) UpperCase(z)
print("first range values are:") for x in range(10): print(x) print("second range values are:") for y in range(22,50,3): #print(y) y = int(y) if (y % 2) != 0: # print(y) # print('{0},it is an odd number'.format(y)) print(y,'it is an odd number') else: # print("{0},it...
def dating_age(age): age = float(age) range_age = (age/2)+5 return range_age your_age = input("Enter your age: ") dating_age = dating_age(your_age) print("The range of age of your dating girlfriend has to be ",format(dating_age))
foods = ["bacon","cheese","sausage","burger","pizza","pasta"] # for f in foods: for f in foods[1:5]: print(f) # print(len(f)) if f == 'bacon': print("it can be an ingredients of burger") elif f == 'cheese': print("it can be ingredients of burger or pizza or pasta") elif f == 'sausag...
# importing required libraries import pandas as pd from sklearn.neighbors import KNeighborsClassifier from sklearn.metrics import accuracy_score # read the train and test dataset train_data = pd.read_csv('train-data.csv') test_data = pd.read_csv('test-data.csv') # shape of the dataset print('Shape of training data :'...
''' In this project, you will visualize the feelings and language used in a set of Tweets. This starter code loads the appropriate libraries and the Twitter data you'll Need! Tweet file can be downloaded from here: https://drive.google.com/open?id=1F7kzxvfidrwWmzExPty7QoW6eXwDTj7w ''' from wordcloud import WordCloud fr...
import turtle as t # n = int(input()) n = 60 t.shape('turtle') t.speed('fastest') # t.color('red') # t.begin_fill() for i in range(n): t.circle(120) t.right(360/n) # t.end_fill() t.mainloop()
class Rectangle: def __init__(self, x1, y1, x2, y2): self.x1 = x1 self.y1 = y1 self.x2 = x2 self.y2 = y2 rect = Rectangle(x1=20, y1=20, x2=40, y2=30) x = abs(rect.x1 - rect.x2) y = abs(rect.y1 - rect.y2) area = x*y print(area) import math class Point2D: def __init__(self,...
word = input('단어를 입력하세요: ') print(word == word[::-1]) print(list(word) == list(reversed(word)))
class Person: def __init__(self, name, age, address): self.hello = '안녕하세요' self.name = name self.age = age self.address = address def greeting(self): print('{0} 저는 {1}입니다.'.format(self.hello, self.name)) maria = Person('마리아', 20, '서울시 서초구 반포동') maria.greeting() print(...
#!/usr/bin/env python # -*- coding: utf-8 -*- import urllib, json from speech import Speech class Weather(): API_KEY = '01daaa0160eb1f77' LANG = 'US' COUNTRY = 'POLAND' CITY = 'WROCLAW' def __init__(self, country=COUNTRY, city=CITY, lang=LANG, api_key=API_KEY): self.API_KEY = api_key ...
name = input("What is your name? ") maths_mark = int(input("What was your Maths mark? ")) chem_mark = int(input("What was your Chemistry mark? ")) phy_mark = int(input("What was your Physics mark? ")) overall = maths_mark + chem_mark + phy_mark if overall >= 70: print("Your grade is, A") elif overall >= 60: ...
# conditional (if) statements x = int(input("enter x 1-5 or more: ")) if x == 1: print("its one") if x == 2: print("nigger") if x == 3: print("ur mom") if x == 4: print("GOD!!!!!!") if x == 5: print("lol") if x > 5: print("u can't do that") y = int(input("(hint:what's 9+10)1 or 2")) if y == 1: prin...
def cost_ground_ship(weight): if weight <= 2: return (weight * 1.50) + 20 elif (weight > 2) and (weight < 6): return (weight * 3.00) + 20 elif (weight > 6) and (weight < 10): return (weight * 4.00) + 20 elif weight > 10: return (weight * 4.75) + 20 def cost_drone_ship(weight): if weight ...
import argparse import json def load_json(file): with open(file, "r", encoding='utf-8') as reader: return json.load(reader) def write_text(file, text): with open(file, "w", encoding='utf-8') as writer: writer.write(text) def main(args): input_data = load_json(args.input_file) exceptions = ['...
from tkinter import * import pygame from tkinter import filedialog pygame.init() root = Tk() class Player: def __init__(self, master=None): self.root = root self.window() self.labels() self.buttons() root.mainloop() def window(self, **kwargs): self.w_height ...
#creation du triangle rows = 10 k = 2 * rows - 2 lines = [] #Faire un triangle for i in range(rows, -1, -1): line = "" for j in range(k-rows, 0, -1): line += " " k = k + 1 for j in range(0, i + 1): line += "**" line += "*" lines.append(line.ljust(19, " ")) ...
import cv2 import numpy as np # Read image img = cv2.imread("imori.jpg") img_origion = img.copy() img = img.astype(np.float) b = img[:, :, 0].copy() g = img[:, :, 1].copy() r = img[:, :, 2].copy() # Grayscale # You could use the cv2.cvtColor() to change the rgb image into grayscale. gray = cv2.cvtColor(img_origion, c...
import random long_password = int(input('Enter lenght of your password: ')) password = "" for x in range(long_password): int_character = random.randint(33, 127) password += str(chr(int_character)) print(password)
############################### ## # ## WEEK 4 HOMEWORK # ## # ## \o/ # ############################### # YOUR ASSIGNMENT: # For all the exercises below, test your function by calling it # (if it has parameters, test it with diffe...
#understanding basic types #types are inferred by runtime automatically a = 10 print(a) print(type(a)) b = 13.6 print(type(b)) c = 'abc' print(type(c)) e = False print(e) print(type(e))
'''consecutive check''' def check_consecutive(d): d if 14 in d: d.append(1) d.sort() strike = 0 maxi = 0 m = 0 while m<len(d): newgroup = [] newgroup.append(d[m]) n=m+1 while n<len(d): if d[n] in newgroup: n=n+1 ...
""" 信号和槽,在之后的学习会了解这两个qt的核心东西 """ import sys from PyQt5.QtCore import QCoreApplication from PyQt5.QtWidgets import QWidget, QApplication, QPushButton class Example(QWidget): def __init__(self): super(Example, self).__init__() self.initUI() def initUI(self): btn = QPushButton('quit',...
# Seasons month = input("Enter month: ") day = int(input("Enter day: ")) if (month == "March"): if day >= 20: season = "Spring" else: season = "Winter" elif (month == "June"): if day >= 21: season = "Summer" else: season = "Spring" elif (month == "September"): if day >= 22: season = "Fall...
# Graduation Condition gpa = float(input("Enter GPA: ")) lecture_num = int(input("Enter lecture number: ")) if (lecture_num < 47): if (gpa < 2.0): result = "Not enough number of lectures and GPA!" else: result = "Not enough number of lectures!" else: if (gpa < 2.0): result = "Not enough GPA!" else...
num1 = input("Enter the first number: ") num2 = input("Enter the second number: ") list_num1 = [] list_num2 = [] match = 0 for i in num1: list_num1.append(i) for i in num2: list_num2.append(i) list_num1.reverse() list_num2.reverse() for i in range((min(len(list_num1),len(list_num2)))): if list_num1[...
# Sum of the last two digits num = input("Please enter an integer number: ") if(len(num) > 1): result = int(num[-1]) + int(num[-2]) else: result = int(num) print("Result is", result)
# Hypotenuse edge1 = float(input("Please enter the first edge: ")) edge2 = float(input("Please enter the second edge: ")) hypotenuse = float((edge1 ** 2 + edge2 ** 2) ** 0.5) print("Hypotenuse is", hypotenuse)
def solution(numbers, target): sup = [0] for i in numbers: sub = [] for j in sup: sub.append(j + i) sub.append(j - i) sup = sub return sup.count(target) from collections import deque def solution_BFS(numbers, target): answer = 0 queue = deque([(0, 0)...
filename_1 = "p1_input.txt" filename_2 = "p2_input.txt" class Deck: def __init__(self, starting_cards): self.deck = starting_cards def peek(self): return self.deck[0] def pop(self): card = self.peek() self.deck = self.deck[1:] return card def push(self, card): self.deck.append(card) def re...
nome = input('Olá! Qual é o seu nome?') print('Olá', nome , '!','seja muito bem vindo ao mundo da programação') # aaaaaaaaaaaaaaaaaaaaaaaaaaa a jfkdls fjdka fdjkla fjkdlsa jdksfla fjkdsla
def binarySearch(arr,low,high,element): while low<high: mid=int((low+high)/2) if(arr[mid]==element): return mid+1; elif(arr[mid]<element): low=mid+1 else: high=mid-1 return low if arr[low]>element else low+1 def binaryInsertionSort(arr): ...
class Node: def __init__(self, lchild = None, rchild = None, value = -1, data = None): self.lchild = lchild self.rchild = rchild self.value = value self.data = data class Bst: """Implements Binary Search Tree""" def __init__(self): self.l = [] #nodes ...
def makeIteration(previous_set, base_set, bound): new_set = set() for x in base_set: for y in previous_set: if x*y < bound: new_set.add(x*y) return new_set def isPrime(x): if x < 2: return False if x == 2: return True for i in...
def triangle(n): return n*(n-1)/2 def pentagonal(n): return n*(3*n-1)/2 def hexagonal(n): return n*(2*n - 1) tri_set = set() pent_set = set() hex_set = set() #n1, n2, n3 = 1,1,1 for t in xrange(1, 100000): tri = triangle(t) if ((tri in pent_set) and (tri in hex_set)): ...
# arrays 1 import array as arr ar = arr.array('I', [2, 3, 3, 3, 4]) for i in range(0, len(ar)): print(ar[i]) ar.append(8) print(ar) ar.reverse() print(ar) print(str(ar.itemsize)) print(str(ar.buffer_info())) freq = 0 for i in ar: if (i == 3): freq = freq + 1 print(freq) ar.extend(list([8, 6, 48])) prin...
def bsort(arr): for i in range(len(arr)): for j in range(0,len(arr)-i-1): if arr[j] > arr[j+1]: arr[j],arr[j+1] = arr[j+1],arr[j] for x in range(len(arr)): print(arr[x]) print("iteration") bsort([45,3,78,54,4])
class stack(): def __init__(self): self.stack = [] def isEmpty(self): return self.stack == [] def push(self,item): self.stack.append(item) def pop(self): data = self.stack[-1] # returns the last element added, -2 would give second last etc del self.stack[-1] ...
def fib(n): a,b = 0,1 while a < n: print(a,end =' ')#appends with space instead of newline a,b = b,a+b def area(b,h): a = b * h * 0.5 return a moves = 0 def hanoi(d,l,r,m): while d>1: hanoi(d-1,l,m,r) print("move disk from ",l," to ",r) ...
import unittest from format_a_name import format_name """ This file tests both objects with the assertEqual tests to compare input values with the expected values that the program should return. """ class NamesTestCase(unittest.TestCase): """test for the format name function""" def test_first(self): ...
#File: Assignment_5_1_LewisRebecca.py #Name: Rebecca Lewis #Date: April 12, 2019 #Course: DSC 510 #Usage: Calculator def performCalculation(operator): '''prompt the user to enter two numbers and perform a calculation. print the calculated value''' x,y = input("Enter two numbers separated by a comma:\n...
import random def bogo(scrambled, match): scrambled, MATCH = reformat(scrambled), reformat(match) count = 0 while scrambled != MATCH: random.shuffle(scrambled) count += 1 print('ITERATIONS: ', count) def reformat(string): return list(string.lower()) bogo('lolhe', 'hello')
from random import randrange def fallout_hacking(filename): LEGNTH, COUNT = introduction() words = Words('words.txt', LENGTH, COUNT) game = Game(words) player = Player() words.output() while player.has_guesses: game.turn(player) class Words: def __init__(self, filename, LENGTH, COU...
import random def game(lower=1, upper=101): response = '' count = 0 while response != 'correct': guess = random.randrange(lower, upper) response = get_user_input(guess) lower, upper = set_bounds(response, lower, upper, guess) count += 1 print_statistics(guess, count) de...
from math import sqrt, asin, acos, sin, cos, pi def main(): triangle = Triangle(a=3, b=4, C=90) while triangle.is_solved() == False: triangle = law_of_sines(triangle) triangle.sides = pythagorean_theorem(triangle.sides) triangle.angles = solve_for_an_angle(triangle.angles) return tr...
def get_information(): user = {} prompts = {'name': 'What\'s your name?', 'age': 'How old are you?', 'username': 'What\'s your reddit username?'} for prompt in prompts: user[prompt] = input('{0} :'.format(prompts[prompt])) print('Your name is {0}, you are {1} years ...
# Enter your code here. Read input from STDIN. Print output to STDOUT from itertools import combinations_with_replacement a,b = input().split() for i in combinations_with_replacement(sorted(a),int(b)): print("".join(i))
# Program:Debug #01# Due Date: 10/3/18# Programmer: <your name># Description: This program will track the number of calories burned after # 10, 15, 20, 25, and 30 minutes given that you burn 4.2 calories# per minute.# Note: It should not print calories burned after 5 min...
#Variables months = int() weeks = int() week_value = int() month_total = int() month_average = float() total_inches = int() ave_inches = float() # Outer loop to determin how nuch snow fell in total for months in range(1,6): # Inner loop determine the monthly total for weeks in range(1,5): ...
#2/24/2020 import random #Declare Variables guess = int() game_number = int() user_answer = str() counter = int() user_answer = "Y" # Loop to play a Game while user_answer == "Y": game_number = random.randint(1,50) # For Loop for counter in range(0, 3): #ask user for their gues ...
# Declare variables letterGrade = str() score = int() score = int(input("Enter your test score: ")) # If and else statment if score <= 70: letterGrade = "C" print(letterGrade) elif score <= 80: letterGrade = "B" print(letterGrade) elif score <= 90: letterGrade = "A" print(lette...
def include_members(policy: dict, role_members: dict) -> (bool, dict): """ Include a set of members with specific roles in an IAM policy. Args: policy: The policy to include the role members in. role_members: A mapping of role names to iterables of members. Retu...
name=input("Enter String to be reversed") str="" for i in name: #print(i,"\n") str=i+str print(str)
num=int(input("Enter a Number")) sum=0 for i in range(1,num+1): sum=sum+i print(sum)
list1=[[1,1],[1,1]] list2=[[1,2],[1,2]] list3=[[0,0],[0,0]] count=0 for i in range (0,2): for j in range(0,2): if list1[i][j]==list2[i][j]: count=count+1 print(count,"are the number of matching corresponding elements")