text
stringlengths
37
1.41M
til = input('Tilni tanlang: uz/en ? ') if til == 'uz': print('Assalomu alaykum') elif til == 'en': print('Hello') else: print('uz/en lardan birini tanlang')
a = int(input("son kirg'izing:")) b = int(input("son kiriting:")) if(a > b): print("togri") else: print("notogri")
fon = {} fon['a'] = 123 fon['b'] = 456 print(fon) print(fon.items()) print(fon.keys()) print(fon.values()) for k,v in fon.items(): print(k,fon[k],v)
L = ["a", "b", "c", "d", "e"] def opgave3(L): print(L[1: -3]) #opgave3(L)
from tkinter import * from random import randint import time class Plotter(): def __init__(self): self.running = True self.messageCounter = 1 self.minValue = 0 self.maxValue = 100 self.s = 1 self.x2 = 50 self.y2 = self.value_to_y(randint(0, 100)) ...
from math import isclose class PerfectNumberChecker(): perfectNumberList = [] def fillPerfectNumberList(self): candidateNumber = 1 while candidateNumber < 10000: self.perfectNumberCheck(candidateNumber) candidateNumber += 1 def printPerfectNumberList(self): ...
# If Statements # Use boolean logic to set is_hot and is_cold variables to True or False. is_hot = False is_cold = False # Use an if statement to determine if the variable "is_hot" is equal to True and if so print "It's a hot day", "Drink plenty of water" and "Enjoy your day". if is_hot: print("It's a hot day") ...
__author__ = 'yna1' import math #Dictionaries #have keys instead of indexes dictEx = ({"Age":35,"height":"6'3","Weight":165}) #DICTIONARIES ARE Immutable print dictEx print dictEx.get("Age") print dictEx.items() #Prints the keys and the values print dictEx.values() #prints just the values dictEx.pop("height") #...
# Copyright 2012 Dorival de Moraes Pedroso. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. from numpy import ones from numpy.random import seed, random, randint, shuffle def Seed(val): """ Seed initialises random numbers generator ...
#!/usr/bin/python3 str = input("请输入:") print("你输入的内容是: " + str) # name = 'oopxiajun'; # print(name);
while True: number = input('Number: ') try: if int(number) > 0: break except ValueError: pass mc = [str(i) for i in range(1,6)] digits = [n for n in number][::-1] result = str(sum([int(item) for item in ''.join([str((2 * int(n))) for n in digits[1::2]])]) + sum([int(n) for n in ...
def diamond(): row = 1 n = 1 while row <= 5: column = 1 #printing the spaces before the stars in every row while column <= abs(3 - row): print("\b "), column += 1 #printing the stars in every row column = 1 while column <= 2 * n - 1: ...
from Q2input import * # Your code - begin output = {} #Appending the key,value pair to the output dictionary for i in Dic1.keys(): if Dic1[i] not in Dic2.keys(): output[i] = Dic1[i] for j in Dic2.keys(): if Dic2[j] not in Dic1.keys(): output[j] = Dic2[j] #Adding the 2 values with same key an...
#defining a function to print a given message a given number of times def print_n_messages(m, n): i = 0 while i < n: print(m) i += 1
def factorial(n): ## Your code - begin if n > 0: #base case to exit recursion return(n * factorial(n - 1)) else: return 1 ## Your code - end if __name__ == "__main__": n = input("Enter number: ") output = factorial(n) print output
def even_elements(l): ## Your code - begin l1 = [i for i in l if i % 2 == 0] return l1 ## Your code - end if __name__ == "__main__": l = range(10) print "input = ", l print even_elements(l)
#finds if binary tree is balanced class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class BalancedSolution: def isBalanced(self, root): if root is None: return True return self.getHeight(r...
#counts the lenght of the last word class LenLastWordSolution: #one Way def lengthOfLastWord(self, s): counter = 0 for l in range(len(s) - 1, -1, -1): if s[l] != " ": counter += 1 elif counter > 0: break return counter #second w...
set1 = {2, 1, 3} set2 = {1, 2, 3} print(set1.intersection(set2)) print(set1 - set2) print(set2.issubset(set1)) print(set1 != set2)
num = int(input('Digite um numero :')) res = num %2 if res == 0: print('O numero {} que você digitou e par'.format(num)) else: print('O numero {} que digitou e impar'.format(num))
pi = float(input('Qual o valor do produto?')) d = (5/100)* pi pf = pi - d print('O produto custa {:.2f}R$ com desconto de 5% o valor será de {:.2f}R$'.format(pi, pf))
al = float(input('Qual altura da parede:')) la = float(input('Qual a largura da parede :')) area = al * la li = area / 2 print('A parede tem area de {:.2f}m² vai ser utilizado {}l de tinta '.format(area, li))
cont = ('ziro', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen','fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen','twenty') while True: num = int(input('Digite um numero entre 0 e 20 : ')) if 0 <= num <=20:...
# 作者 ljc # 将图像的绿色值变为0 import cv2 as cv import numpy as np img = cv.imread('out.jpg') print(img.shape) print(img.size) print(img.dtype) # shape 包含 宽度,高度 和通道数 # size 图像像素的大小 # Datatype 图像的数据类型 如uint8 # cv.imwrite('111.jpg', img)
# Capture information name = input('Please tell me your name: ') age = input('Please tell me your age: ') reddit_username = input('Please tell me your Reddit Username: ') # Print the information in requested format print('Your name is ' + name + ', You are ' + age + ' years old, \ and your username is ' + reddit_usern...
#!/usr/bin/env python # coding: utf-8 # In[1]: # Step 1: Write a function that can print out a board. Set up your board as a list, # where each index 1-9 corresponds with a number on a number pad, so you get a 3 by 3 board representation. # This function is to display a board of up to 9 inputs. This board will dis...
from typing import List, Optional from brackettree import parser class Node: name: str children: List["Node"] def __init__(self, name: str) -> None: self.name = name self.children = [] def find(self, name: str) -> Optional["Node"]: if self.name == name: return s...
# Assume s is a string of lower case characters. # Write a program that counts up the number of vowels contained in # the string s. Valid vowels are: 'a', 'e', 'i', 'o', and 'u'. # For example, if s = 'azcbobobegghakl', your program should print: # Number of vowels: 5 # For problems such as these, do not include ra...
import pandas as pd from pandas import Series, DataFrame import numpy as np import matplotlib.pyplot as plt import seaborn as sns st_df = pd.read_csv("StudentsPerformance.csv") print("________data header__________") st_df.head() print("________discription_________") st_df.info() st_df.describe() prin...
from functools import reduce l1 = [1, 2, 3, 4, 5] newlist = [x*3 for x in l1] sum1 = reduce(lambda a,b:a+b, l1) sum2 = reduce(lambda a,b:a+b, newlist) print(sum1) print(sum2)
from functools import partial, wraps basetwo = partial(int, base=2) basetwo.__doc__ = "test" print basetwo('0010') print int('0010', base=2) print('-'*30) def my_decorator(f): @wraps(f) def wrapper(*args, **kwargs): print('calling decorated func') f(*args, **kwargs) return retu...
# -*- coding:utf8 -*- # 练习for循环 # Created by fanghuabao on 2017/9/25. for i in range(10): print('loop ', i) for a in ['a', 'b', 'c']: print(a)
#Número par/impar #Número positivo/negativo x= input('Ingrese un número: ') if not x.isalpha(): x=int(x) if x%2==0: if x>=0: print(f'El número {x} es par y positivo') else: print(f'El número {x} es par y negativo') else: if x>=0: pr...
def comma(lv): for i in range(0, len(lv) - 1): print(str(lv[i]), end = ', ') else: print('and' + ' ' + str(lv[-1])) return
# A dumb program to learn and mess around with command line while True: try: x = int(input('give me an int: ')) except ValueError: print ('Dont be an idiot') continue else: break if x < 4: print ('less than 4') elif x == 4: print ("egual 2 4") else: print ('thats a big number') print("you...
import pandas as pd import numpy as np # 1. read data df = pd.read_csv("ChurnData.csv") df['churn'] = df['churn'].astype('int') # 2. Determine x, y with right columns X = df[['tenure', 'age', 'address', 'income', 'ed', 'employ', 'equip']] .values #.astype(float) y = df['churn'].values # 3. Standardlize X from sklea...
# Any sequence or iterable can be unpacked into variables using a simple assigement. # The only requirement is that the number of variables and structure match the sequence. print('unpacking a tuple:') p = (4, 5) x, y = p print(x) print(y) print('unpacking a List:') data = ['ACME', 50, 91.1, (2012, 12, 21)] name, sha...
''' You want to return multiple values from a function. ''' # Solution: Simply return a tuple. # A tuple is actually created. def myfun(): return 1, 2, 3
import random def gameplay(): number = random.randint(0,100) NString=str(number) print(number) guess='' tippek=[] while guess!=NString: # for x in tippek: print(tippek) guess=input('Tipped: ') if guess!=NString: if int(guess)<number: ...
from typing import Tuple from logic import * ASSUMPTIONS_HEADER = 'ASSUMPTIONS' GUARANTEES_HEADER = 'GUARANTEES' INS_HEADER = 'INPUTS' OUTS_HEADER = 'OUTPUTS' END_HEADER = 'END' COMMENT_CHAR = '#' FILE_HEADER_INDENT = 0 DATA_INDENT = 1 TAB_WIDTH = 2 def parse(file_path: str) -> Tuple[str, str, str, str]: """Ret...
import csv import os.path def create_csv(csv_out, headers): if csv_out[-4:] != '.csv': raise ValueError('Expecting a csv_out argument ending with ".csv"') if os.path.isfile(csv_out): print(csv_out + ' already exists. File will not be overwritten') return if type(headers) is not lis...
x = 5 y = 6 z = 5 if z < y > x: print('y is greater than z va y is greater than x') if x == z: print('x is equal z') if y != x: print('y is not equal x') # if elif else if x > y : print('x is greater than y') elif x==y: print('x is equal y') else: print('x is less than y')
int_var = 5 str_var = 'string variables' bool_var = True print(int_var) print(str_var) print(bool_var) # gan gia tri cho nhieu bien x,y = (5,10) # or x,y = 5,10 print(x) print(y)
import numpy as np print(np.array([True, 1, 2])) print(np.array([3, 4, False])) # array in np chi chua duy nhat 1 kieu du lieu # Arue se bi convert ve 1 # False se bi convert ve 0 print(np.array([True, 1, 2]) + np.array([3, 4, False])) # Select element in array same in list a = np.array([2, 4, 5, 2, 1, 9]) print(a[3...
""" 1. Bygg ett program som låter användaren mata in ett reg.nr och skriv ut de två grupperna var för sig; använd slicing-syntax för att dela upp inputsträngen. Ex. Ange regnr: ABC663 Bokstävsgrupp: ABC Siffergrupp: 663 """ reg_nr = input("Skriv reg nr:") print(f"Regnr: {reg_nr}\nBokstävsgrupp:{reg_nr[0:3]}\nSiffer...
""" ------------------------------------------------------------------------------- Name: main.py Purpose: Multiple choice review quiz of course content Author: Wang.J Created: 01/14/2021 ------------------------------------------------------------------------------- """ # title print("*** Multiple Choice Computer ...
""" RSA functions """ """ Encrypt message m (decimal representation) using RSA with key (e,n) """ def encrypt_rsa(m, e, n): return pow(m,e,n) """ Decrypt message c to decimal representation using RSA with key (d,n) """ def decrypt_rsa(c, d, n): return pow(c,d,n) # Note that while the above functions seem ...
from datetime import datetime #nasc = input('Digite a data de nascimento (00/00/0000): ') nasc = "06/10/1994" nasc = datetime.strptime(nasc, '%d/%m/%Y') hoje = datetime.today() anos = hoje.year - nasc.year - ((hoje.month, hoje.day) < (nasc.month, nasc.day)) print(anos)
balance = 3329 annualInterestRate = 0.2 def payDebt(payment): balanceCopy = balance monthlyIntRate = annualInterestRate / 12 for month in range(12): balanceCopy -= payment balanceCopy += balanceCopy * monthlyIntRate return balanceCopy <= 0 payment = 10 debtPaid = False while not debtPaid: debtPaid...
'this program calculates the intra-variable and inter-variable of power system input.' 'the input is one-year data of household load, PV generation, and EV charging' 'the size of these inputs should be the same' import numpy as np class getdata(object): #to get any one-year timeseries data from csv def __init__(s...
######################################################################## # This file is based on the TensorFlow Tutorials available at: # https://github.com/Hvass-Labs/TensorFlow-Tutorials # Published under the MIT License. See the file LICENSE for details. # Copyright 2017 by Magnus Erik Hvass Pedersen ###############...
import random game=['rock','paper','scissor'] p1=random.choice(game) print("party 1:",p1) p2=random.choice(game) print("party 2:",p2) if p1=='rock' and p2=='scissor': print("p1 won the task") elif p1=='paper' and p2=='rock': print("p1 won the task") elif p1=='scissor' and p2=='paper': print("p1 won the task...
# # WELCOME TO PYTHON # # # Programming Python. WEEK 03 # 019 --> 020 # TASK 001 - Types of numbers print(type(10)) # integer print(type(10.5)) # float print(type(5+2j)) # complex print(type(5 == 5)) # boolean #------------------------------------------------- # Task 002 - COMPLEX Number a = 1+2j print(a.imag) print(a....
#!/usr/bin/python3 ''' Code to lear how isinstance() works ''' def is_kind_of_class(obj, a_class): ''' Verify if obj is an instance of a_class''' return isinstance(obj, a_class)
#!/usr/bin/python3 ''' Project for studying doctest in python''' def matrix_divided(matrix, div): '''Function that divides all elements of a matrix''' if div == 0: raise ZeroDivisionError("division by zero") if isinstance(div, (int, float)) is False: raise TypeError("div must be a number"...
#!/usr/bin/python3 ''' Code to learn how to read a file ''' def read_file(filename=""): ''' Read filename ''' with open(filename, encoding='UTF-8') as f: for i in f: print(i, end='')
#!/usr/bin/python3 def square_matrix_simple(matrix=[]): new_matrix = [] for sublist in matrix: new_matrix.append(list(map(lambda n: n ** 2, sublist))) return new_matrix
###################################################################### # This module will read and extract Sudoku image from given picture. # The extracted image will be saved in image directory ###################################################################### import numpy as np import cv2 def image_preprocess(...
import esper class Position: def __init__(self, x=0.0, y=0.0): self.x = x self.y = y class Velocity: def __init__(self, x=0.0, y=0.0): self.x = x self.y = y class MovementProcessor(esper.Processor): def __init__(self, minx, maxx, miny, maxy): super().__init__() ...
#---------------# # DAY 6 # #---------------# def cycle(LS): index = LS.index(max(LS)) steps = LS[index] LS[index] = 0 for i in range(1, steps+1): LS[(index+i)%len(LS)] += 1 ## Part 1 seenPossibilities = set() currentState = [4,10,4,1,8,4,9,14,5,1,14,15,0,15,3,5] totalCycles =...
def print_reverse(string): print(string[::-1]) print_reverse("python") def print_score(score_list): print(sum(score_list)/len(score_list)) print_score([1,2,3]) def print_even(even_list): for i in even_list: if i%2 == 0: print(i) def print_keys(dic): for keys in dic.keys(): ...
Power = False # 전원 : false - off, true - on Volume = 10 # 볼륨 : 1 ~ 20 Channel = 1 # 채널 : 1 ~ 10 def power() : global Power if Power == False : Power = True print("| 전원을 켰습니다. |") else : Power = False print("| 전원을 껐습니다. |") def setVolumnUp(size) : globa...
book = {} book["파이썬"] = "최근에 가장 떠오르는 프로그래밍 언어" book["변수"] = "데이터를 저장하는 메모리 공간" book["함수"] = "작업을 수행하는 문장들의 집합에 이름을 붙인 것" book["리스트"] = "서로 관련이 없는 항목들의 모임" print("다음은 어떤 단어에 대한 설명일까요\n") print("==================================") for key in book.keys(): print(book[key],"?") i = 1 for probloem in boo...
__author__ = 'Deeplayer' # 6.15.2016 # import numpy as np import matplotlib.pyplot as plt from TwoLayerNN import TwoLayerNet from data_utils import load_CIFAR10 # Load the data def get_CIFAR10_data(num_training=49000, num_validation=1000, num_test=1000): """ Load the CIFAR-10 dataset from disk and perform pre...
from data_utils import load_CIFAR10 import matplotlib.pyplot as plt from Linear_Classifier import * import numpy as np def get_CIFAR10_data(num_training=49000, num_validation=1000, num_test=1000, num_dev=500): """ Load the CIFAR-10 dataset from disk and perform preprocessing to prepare it for the linear clas...
import random MOTS = ("python", "jumble", "easy", "difficult", "answer", "xylophone") mot = random.choice(MOTS) mot_choisi = mot mot_masque = mot_choisi[0:-1]+"_" chance=3 while chance>0: print(f"Le mot choisi est {mot_masque} ") devinette=input("Trouver la derniere lettre: ") if (devinette == mot_...
#This is a guess the number game. import random guessesTaken = 0 print ('System: Hello! What is your name?') myName = input("Me: ") number = random.randint (1, 20) print('System: Well, '+myName+', I am thinking of a number between 1 and 20') while guessesTaken < 6: guess = int(input("System: Take a guess: ")) ...
class MagicDictionary: def __init__(self): """ Initialize your data structure here. """ self.words = {} def buildDict(self, dict: List[str]) -> None: """ Build a dictionary through a list of words """ for w in dict: self.word...
''' # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail ''' def summation(n): if (n==0): return 0; if (n&1): ...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: parents = {} # key is TreeNode, value: TreeNode that is the parent moves = 0 def traverse(self, node): if (node): ...
#! /usr/bin/python3 import sys import math line = sys.stdin.readline() date = line.split() if (date[0] == "OCT" and date[1] == "31") or (date[0] == "DEC" and date[1] == "25"): print("yup") else: print("nope")
class TimeMap: def __init__(self): """ Initialize your data structure here. """ self.ht = {} # key: key of set, value: dict of: key: timestamp, value: value def set(self, key: 'str', value: 'str', timestamp: 'int') -> 'None': if key not in self.ht: self.h...
# class LLNode: # def __init__(self, val, next=None): # self.val = val # self.next = next class Solution: def solve(self, node): # Write your code here fast = node slow = node vals = [slow.val] j = 0 while fast != None and fast.next != None: ...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ oneleng = 0 p...
class Solution(object): def isPerfectSquare(self, num): """ :type num: int :rtype: bool """ counter = 1 odd = 1 while(counter <= num): if(counter == num): return True odd += 2 counter += odd print...
class Solution: def findIntegers(self, num): """ :type num: int :rtype: int """ total = num saved = num if(num == 1): return 2 if(num == 2): return 3 if(num == 3): return 3 maxi = 0 num = num ...
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def getIntersectionNode(self, headA, headB): """ :type head1, head1: ListNode :rtype: ListNode """ p1 = headA...
n = int(input()) for i in range(n): num = int(input()) if num % 2 == 0: print(str(num) + " is even") else: print(str(num) + " is odd")
# -*- coding: utf-8 -*- """ Created on Wed Dec 30 01:14:25 2020 @author: user """ day=input("請輸入月及日為:").split() m=day[0] d=day[1] m=int(m) d=int(d) if(m==1): if(d>20): print("星座為Aquarius") else: print("星座為Capricorn") elif(m==2): if(d>18): print("星座為Pisces") else: print(...
# -*- coding: utf-8 -*- """ Created on Mon Dec 28 15:31:05 2020 @author: user """ x=input("輸入查詢學號為:") st={"123":"Tom DTGD","456":"Cat CSIE","789":"Nana ASIE","321":"Lim DBA","654":"Won FDD"} if x in st: print("學生資料為:"+x,st[x]) else: print("無該名學生")
num = [] num1 = int(input("How many number do you want to write (range is 1-20)?")) if num1 < 1 or num1 > 20: print("I SAID RANGE IS 1-20... Run again now...") else: for i in range(num1): temp = input("Enter Number " + str(i + 1) + ": ") num.append(temp) flag = 0 num2 = num[:] num2.sort() if (n...
import cv2 from evaluation import * import pickle def rectangle_area(rect): x, y, w, h = rect return w*h def contour2rectangle(contours): # Get bounding rectangle for each found contour and sort them by area rects = [] for i in contours: y, x, h, w = cv2.boundingRect(i) rects.app...
""" Creates and adds data to JSON file """ import os import json filename = './url_data.json' class UrlData: def add(self, url, tags): if os.path.isfile(filename): # File already exists, return populated dict. with open(filename) as file: data = json.load(file) ...
import random import string class WordList(object): def __init__(self): self.__file_a = "wordsFiles/palavras.txt" self.__file_b = "wordsFiles/words.txt" def createWordList(self, file_choice): """ Depending on the size of the word list, this function may take a while to finish. """ pri...
import itertools def zbits(n, k): """ :param n: binary strings of length :param k: k zero bits :return: all binary strings of length n that contain k zero bits, one per line. """ # specify the number of zero num_zero = "0" * k # specify the number of one num_one = "1" * (n-k) ...
class TBankomat: def __init__(self,n5,n10,n20,n50,n100,n200): self.n5 = n5 self.n10 = n10 self.n20 = n20 self.n50 = n50 self.n100 = n100 self.n200 = n200 @property def max(self): return self.n5 * 5 + self.n10 * 10 + self.n20 * 20 + self.n50...
from random import randint #import matplotlib.pylab as plt ALPHABET = ' ABCDEFGHIJKLMNOPQRSTUVWXYZ' def encrypt(plain_text, key): plain_text = plain_text.upper() cipher_text = "" for index, char in enumerate(plain_text): key_index = key[index] char_index = ALPHABET.find(char) ...
from math import sqrt from math import floor def factor(num): factors = [] limit = floor(sqrt(num)) for n in range(2, limit): if num % n == 0: factors.append(n) factors.append(int(num/n)) return sorted(factors) if __name__ == "__main__": print...
q = int(input("length: ")) i = int(input("frequency: ")) w = 1 while True: print("a" * w) w += i if w >= q: while w != 1: print("a" * w) w -= i
#!/usr/bin/python while True: s=raw_input('Enter someing:') if s=='quit': break print 'Length of the string is',len(s) print 'Done'
#!/usr/bin/python # -*- coding: UTF-8 -*- import time; import ticks = time.time() print "当前时间戳为:",ticks localtime = time.localtime(time.time()) print "本地时间为:",localtime localtime = time.asctime(time.localtime(time.time())) print "本地时间为:",localtime print time.strftime("%Y-%m-%d %H:%M:%S",time.localtime()) print ...
#This module defines a subclass of Dealer. """ Class ------ Dealer attributes: inherits from Player methods overriding: get_strategy: dealer's strategy. show_result:print hand and values """ from players.player import Player class Dealer(Player): @classmethod def get_strategy(cl...
#This module defines a basic class of card and deck. #Current game version, one standard 52-card deck. """ Class ------ Card ------ Deck attribute: deck: a list of standard 52 cards. method: init_deck: append 52 cards shuffle deal: pop 1 card """ from random import shuffle from d...
def solution(record): answer = [] uidList = dict() for rec in record: cmd = rec.split(" ") if cmd[0] == "Enter" or cmd[0] == "Change": uidList[cmd[1]] = cmd[2] for rec in record: cmd = rec.split(" ") str = uidList[cmd[1]] if cmd[0] == "Enter": ...
x = "Hello World" # str print(type(x)) x = 20 # int print(type(x)) x = 20.5 # float print(type(x)) x = 1j # complex print(type(x)) x = ["apple", "banana", "cherry"] # list print(type(x)) x = ("apple", "banana", "cherry") # tuple print(type(x)) x = range(6) # range print(type(x)) x = {"name" : "John", "age" : 36}...
# wordScrambler.py scrambles individual words in words.txt. Keeps periods at # the ends of words. from random import shuffle f = open('words.txt', 'r') l = f.read().split(' ') for x in range (0,len(l)): word1 = l[x] word = list(word1) shuffle(word) l[x] = ''.join(word) for x in range (0,len(l)): ...
# x = 1 # y = 5 # # if x<y: # # print('Yes') # if x: # print('Yes') # LOGIN # password = '123qwert' # username = 'owambe21' # input_username = input('Please enter username : ') # input_password = input('Please enter password : ') # if input_username == username: # print('Weldone, your username exists'...
# ##DECLARE FILENAME AND OPEN FILE FOR READING # file_name = "functions/words.txt" # file = open(file_name, "r") # ## READ FILE # data = file.read().split(',') # ##IMPORT THE RANDOM MODULE FOR RANDOM VALUE SELECTIONS # import random # ## SELECT A RANDOM CHOICE FROM THE LIST OF WORDS READ FROM THE FILE # selected_wo...
''' This file is your implementation of a Blokus Playing Agent for the tournament. - Change ids to your own. - Choose a name for your AI player. - Don't forget to create your shapes file by the name specified. - Implement the two functions move() and setup(). ''' from GameAgent import GameAgent class ...
a = input() b = input() c = input() if ((a>=b) and (a>=c)): print(a) elif ((b>=a) and (b>=c)): print(b) elif ((c>=a) and (c>=b)): print(c)