Elements with border boxes

I had to make a couple of class elements. Each class element means something. The first class controls the whole thing so I used a text-align code to center the boxes. The next class, I used inline-block so the background color only stretched to the width of the text. The rest of it was all the margin width and color.

Creating a Navigation Bar

This is how I created a Navigation Bar. The first couple of steps I did was actually make the classes and the ids, and create the words, Navigation, Home, Features, Pricing, and About. Then I use margins and display:flex to put them onto the same line and format them correctly. Last thing I did was simply add an aqua background color.

Hangman

https://repl.it/@ArnavGupta5/Hang-Man#main.py
words=["apple","explain","already","steward","deputy","healthy","satisfaction","ballot","reptile","resort"] from random import randint number=randint(0,len(words)-1) wordcreator=words[number] def splitt(word): return[char for char in word] wrong=[] correct=[] isit=False c=0 r=0 length=len(wordcreator) for q in range (0, length,1): correct.append("*") for e in range(0,11, 1): entry=input("Enter a letter: ") r=0 isit=False for w in range (0,length,1): #print(wordcreator[r]) if entry==wordcreator[r]: correct[r]=entry isit=True #r=r+1 #26 and 27 has problem if r==length-1: #print("The value of r is...", r) if isit==False: wrong.append(entry) #if "*"!=correct[r]: #print("You Won!!!!") #break r=r+1 c=c+1 print("Your incorrect letters are: ",wrong) print("You correct letters are: ",correct) print("You have guessed",c,"letters. You have",11-c,"guesses left") if e==10: print("You lost") print("The word was",wordcreator) #Entry():

Pi Calculator

Pi Calculator! Multiplies your inputed number by 3.14 a.k.a pi. Voila, you get the answer. I will add link soon. There is a glitch in repl but feel free to use your terminal to run the program!

pi = 3.14 print(" PI CALCULATOR ") num = float(input("Input number so I can multiply it by pi: ")) num2 = num * pi print("Answer is ", num2,"yo!")

Cube

A simple cube using turtle

import turtle t = turtle.Turtle() t.color("blue") for i in range(4): t.forward(100) t.left(90) t.penup() t.left(90) t.forward(60) t.right(90) t.forward(60) t.left(90) t.pendown() for i in range(4): t.forward(100) t.right(90) t.left(135) t.forward(85) t.backward(85) t.penup() t.backward(55) t.pendown() t.backward(85) t.left(45) t.penup() t.forward(100) t.right(45) t.pendown() t.forward(85) t.penup() t.right(135) t.forward(100) t.left(90) t.forward(100) t.right(135) t.pendown() t.forward(85) t.hideturtle()

Currency Converter

This is a currency converter that includes USD, Pound, Euro, Rupee, and Yen. It was made using pyqt5.

Word Reverse Game

This is word reverse(not really a game). You type a word backwards, and it will write it normally.

def main(): word = input("Enter a word: ") wordsize = len(word) print(wordsize) for i in range(len(word), 0,-1): print(i) spellword = "" for i in range(wordsize, 0, -1): # print(word[i]) print(i) spellword = spellword + word[i-1] print(spellword) main()

Google Chrome Symbol

Chrome symbol no color


import turtle t = turtle.Turtle() #drawing cirle1 r = 100 t.circle(r) #drawing inner circle t.left(90) t.penup() t.forward(80) t.pendown() t.right(90) r = 25 t.circle(r) t.penup() #drawing line1 t.right(120) t.pendown() t.forward(83) t.backward(83) t.seth(90) t.penup() t.forward(30) t.left(90) t.forward(25) #drawing line2 t.pendown() t.right(45) t.forward(74) t.backward(74) #drawing line 3 t.penup() t.seth(0) t.forward(50) t.pendown() t.forward(76) #adding the colors t.penup() t.backward(20) t.right(90) t.forward(10)

This is a hangman game

https://repl.it/@9arnavr/AntiqueTediousConfigfiles#main.py
import random name = input("What is your name?: ") print("Good Luck", name) words = ["computer", "pen", "dog", "plane", "paper", "glue", "damage", "fire", "blaze", "branch", "avacado", "hat", "bat", "ice", "lighting", "wires", "bear"] word=random.choice(words) #print(word) print("Guess a Letter: ") guesses='' turns = 10 while turns > 0: failed = 0 for char in word: if char in guesses: print(char) else: print("_") failed += 1 if failed == 0: print("You won the game!") print("The word is: ", word) break guess = input("Guess a Letter: ") guesses += guess if guess not in word: turns -= 1 print("Incorrect!") print("You have ", turns, "more guesses") if turns == 0: print("Oh No", name, "You lost, the secret word was ", word)

DNA Converter

This program converts a randomly generated DNA string to its corresponding polypeptide. However, while writing the program, I realized that it is more complicated than just basic conversions. The thing is, methionine (AUG) is the only amino acid that can start the strand and the strand is always ended by UUA, UAG, or UGA. So, the ribosome has to stop creating the polypeptide when it sees these. This is still something that I am working on including in the program. Anyway, hope you enjoy it!

from random import randint possiblevals= ["A","C", "T","G"] generatedlist= [] lengthsequence= int(input("Enter a number for the length of the DNA sequence ")) while lengthsequence%3 !=0: lengthsequence= int(input("Remember, nucleic acids are always present in groups of 3 called codons. Your number has to be divisible by 3. Please try again. ")) i=0 #making the DNA sequence while i<lengthsequence: randnum= randint(0,3) sequenceval= possiblevals[randnum] generatedlist.append(sequenceval) i=i+1 print (generatedlist) #making the RNA sequence possiblerna= ["U", "G", "A", "C"] rnalist= [] s=0 while s< lengthsequence: DNAval= generatedlist[s] dnaindex= possiblevals.index(DNAval) rnaconversion= possiblerna[dnaindex] rnalist.append(rnaconversion) s=s+1 print (rnalist) #making the amino acid chain finallist= [] str1="" a=0 b=1 c=2 e=0 p=3 listpossible= ["GCA", "GCC", "GCG", "GCU", "UGC", "UGU", "GAC", "GAU", "GAA", "GAG", "UUC", "UUU", "GGA", "GGC", "GGG", "GGU", "CAC","CAU", "AUA", "AUC", "AUU", "AAA", "AAG", "UUA", "UUG", "CUA", "CUC", "CUG", "CUU", "AUG", "AAC", "AAU","CCA", "CCC", "CCG", "CCU", "CAA","CAG","AGA", "AGG","CGA","CGC","CGG", "CGU", "AGC", "AGU", "UCA", "UCC", "UCG", "UCU", "ACA", "ACC", "ACG", "ACU", "GUA", "GUC", "GUG", "GUU", "UGG", "UAC", "UAU"] listamacids= ["Alanine", "Alanine", "Alanine", "Alanine", "Cysteine", "Cysteine", "Aspartic acid", "Aspartic acid", "Glutamic acid", "Glutamic acid", "Phenylalanine", "Phenylalanine", "Glycine", "Glycine","Glycine","Glycine", "Histidine", "Histidine", "Isoleucine", "Isoleucine", "Isoleucine", "Lysine", "Lysine", "Leucine", "Leucine", "Leucine", "Leucine", "Leucine", "Leucine", "Methionine", "Asparagine", "Asparagine", "Proline", "Proline", "Proline", "Proline", "Glutamine", "Glutamine", "Arganine", "Arganine", "Arganine", "Arganine", "Arganine", "Arganine", "Serine", "Serine", "Serine", "Serine", "Serine", "Serine", "Threonine", "Threonine", "Threonine", "Threonine", "Valine", "Valine", "Valine", "Valine", "Tryptophan", "Tyrosine", "Tyrosine"] while e< (lengthsequence/3): str1="" str1= str1+rnalist[a] str1= str1+rnalist[b] str1= str1+rnalist[c] index= listpossible.index(str1) var= listamacids[index] finallist.append(var) a=a+3 b=b+3 c=c+3 e=e+1 print (len(listpossible)) print (len(listamacids)) print (finallist)

Ultra Proogram

This program is just a combination on all my past programs. :D

#This first one is a number guessing game import random #while flag = True while flag: num = input("Type a number for an upper bound: ") #Starting the Game if num.isdigit(): print("Let's Play!") num = int(num) flag = False: else: print("Invalid input! Try Again!") secret = random.randint(1,num) guess = 5 count = 1 #Asking for the Numbers while guess != secret: guess = input("Type a number between 1 and ' + str (num) + ": ") if guess.isdigit(): guess = int(guess) #If you get it correct or incorrect if guess == secret: print("You got it!") else: print("Try agian!") count += 1 print('It took you', count, 'guesses!') #This next one is a rock paper scissors game import random comp_wins = 0 player_wins = 0 #Asking user to choose rock, paper, or scissors def Choose_Option(): user_choice = input("Choose Rock, Paper or Scissors: ") if user_choice in ["Rock", "rock", "r", "R"]: user_choice = "r" elif user_choice in ["Paper", "paper", "p", "P"]: user_choice = "p" elif user_choice in ["Scissors", "scissors", "s", "S"]: user_choice = "s" else: print("I don't understand, try again.") Choose_Option() return user_choice def Computer_Option(): comp_choice = random.randint(1, 3) if comp_choice == 1: comp_choice = "r" elif comp_choice == 2: comp_choice = "p" else: comp_choice = "s" return comp_choice while True: print("") user_choice = Choose_Option() comp_choice = Computer_Option() print("") #If you won, lost, or tied and a scoreboard if user_choice == "r": if comp_choice == "r": print("You chose rock. The computer chose rock. You tied.") elif comp_choice == "p": print("You chose rock. The computer chose paper. You lose.") comp_wins += 1 elif comp_choice == "s": print("You chose rock. The computer chose scissors. You win.") player_wins += 1 elif user_choice == "p": if comp_choice == "r": print("You chose paper. The computer chose rock. You win.") player_wins += 1 elif comp_choice == "p": print("You chose paper. The computer chose paper. You tied.") elif comp_choice == "s": print("You chose paper. The computer chose scissors. You lose.") comp_wins += 1 elif user_choice == "s": if comp_choice == "r": print("You chose scissors. The computer chose rock. You lose.") comp_wins += 1 elif comp_choice == "p": print("You chose scissors. The computer chose paper. You win.") player_wins += 1 elif comp_choice == "s": print("You chose scissors. The computer chose scissors. You tied.") #Tells number of points user and AI have print("") print("Player wins: " + str(player_wins)) print("Computer wins: " + str(comp_wins)) print("") #Asking if they want to play again user_choice = input("Do you want to play again? (y/n)") if user_choice in ["Y", "y", "yes", "Yes"]: pass elif user_choice in ["N", "n", "no", "No"]: break else: break #This last program is a calculator #Asking for the Numbers and Operation num1 = float(input("Enter First Number: ")) op = (input("Enter Operation: ")) num2 = float(input("Enter Second Number: ")) #Converting Operation to Calculator if op == "+": print(num1 + num2) elif op == "-": print(num1 - num2) elif op == "/": print(num1 / num2) elif op == "*": print(num1 * num2) else: print("Invalid! Try again!")

Hangman

This is my hangman game without a GUI

https://repl.it/join/emtopwks-supython3
#importing random because you need it import random print("this is hangman") #making an insanely long list of words WORDBANK = ["airplane",'hawkeye', 'robin', 'Galactus', 'thor', 'mystique', 'superman', 'deadpool', 'vision', 'sandman', "aquaman", 'pear', 'mango', 'apple', 'banana', 'apricot', 'pineapple','cantaloupe', 'grapefruit','jackfruit','papaya'] UnchosenWordBank = [] guesses = [] attempts = 15 #greet your user name = input("Enter your name ") print("Hello", name.capitalize(), "let's start playing Hangman!") print("The objective of the game is to guess the secret word chosen by the computer.") print("You can guess only one letter at a time. Don't forget to press 'enter key' after each guess.") print("Let the fun begin!") #pick out your secret word secretWord = random.choice(WORDBANK) print(secretWord) print("The number of allowed guesses for this word is:", attempts) g=0 guesses="" #loop da loop your question for g in range(attempts): Word = input("input a letter in lower case ") # just a benchmark # print(Word) # print(guesses) # the meat of it inside of the loop to find the letter if Word in guesses: print("You already guessed this letter, try something else.") continue else: if Word in secretWord: print("Nice guess!") else: print ("missed, try again") continue guesses+=Word
1 2 ... 31