Posts

Showing posts from January, 2022

#4y: Codding in Python {Hand-Cricket Again}

Image
aukaat = [1,2,3,4,5,6,6,6,6,5,4,5,4,4,5] import random as randi def arranger(string):     k = []     for i in (string):         i = i.lower()         k.append(i)     l = ''     for i in (k):         l = l + i     return  l def bat():     global BATscore, Wickets, balls     batsman = int(input('Enter Hit number: '))     bowler = randi.choice(aukaat)     print('Your choice = ', batsman," Computer's choice = ", bowler)     print()     if batsman in range(1,7):         balls +=1         if bowler == batsman:             #out             print('Out!')             Wickets += 1         else:             BATscore += batsman          if final == 'ball':         print()         print('                                         Target = ', Target, '   Runs Required = ', Target - BATscore)          print('                                                                                                                           

#4x: Codding in Python {Rock-Paper-Scissor}

Image
 #imcool list1 = [1,2,3] scoreP = 0 scoreB = 0 import random def logic(i,j):     global scoreP, current     #Rock     if i == 1 and j == 1: current = 0;      if i == 1 and j == 2: current = -1;      if i == 1 and j == 3: current = 1;      #Paper     if i == 2 and j == 1: current = 1;      if i == 2 and j == 2: current = 0;      if i == 2 and j == 3: current = -1;      #Scissor      if i == 3 and j == 1: current = -1;      if i == 3 and j == 2: current = 1;      if i == 3 and j == 3: current = 0;      return current def gap(n):     for i in range(n):         print() def wot(m):     if m == 1: dho = "Rock"     if m == 2: dho = "Paper"     if m == 3: dho = "Scissor"     return dho limit = int(input("Enter score limit:")) while 1==1:     gap(10)     if scoreB == limit-1 or scoreP == limit-1: print("MATCH POINT!")     print("1 = Rock")     print("2 = Paper")     print("3 = Scissor")     player = int(input("

#4w: Coding in Python {Jumbled Words}

Image
 while 1==1:     import itertools, english_words     yourchoices = input(str('Enter letters: '))     yourchoics = yourchoices.strip()     yourchoices =yourchoics.lower()     newwords = []     word =[]     for i in yourchoices:         word.append(i)     n = 0     for p in (itertools.permutations(word)):             newword=''.join(p)                               if newword in (english_words.english_words_lower_alpha_set):             if newword not in (newwords):                 newwords.append(newword)                      for k in (newwords):         print(k) You can copy-paste this code, if you have English Words library included in your device. Link for the same is  here . Or, you will have to use this code .