Tekie.in
Convert your money!
print ("Type 1 for USD")
print ("Type 2 for INR")
print ("Type 3 for EUR")
print ("Type 4 for GBP")
choice = (input ("Enter your choice: "))
print ("Conversion from", choice, "to?")
print ("Type 1 for USD")
print ("Type 2 for INR")
print ("Type 3 for EUR")
print ("Type 4 for GBP")
choice2 = (input ("Enter your choice: "))
amount = float(input("Amount?"))
if choice == "1" and choice2 == "2":
print (amount, "USD in INR is", (amount*79.00))
if choice == "1" and choice2 == "3":
print (amount, "USD in EUR is", (amount*0.99))
if choice == "1" and choice2 == "4":
print (amount, "USD in GBP is", (amount*0.83))
if choice == "2" and choice2 == "1":
print (amount, "INR in USD is", (amount*0.013))
if choice == "2" and choice2 == "3":
print (amount, "INR in EUR is", (amount*0.012))
if choice == "2" and choice2 == "4":
print (amount, "INR in GBP is", (amount*0.010))
if choice == "3" and choice2 == "1":
print (amount, "EUR in USD is", (amount*1.01))
if choice == "3" and choice2 == "2":
print (amount, "EUR in INR is", (amount*80.81))
if choice == "3" and choice2 == "4":
print (amount, "EUR in GBP is", (amount*0.84))
if choice == "4" and choice2 == "1":
print (amount, "GBP in INR is", (amount*96.01))
if choice == "4" and choice2 == "2":
print (amount, "GBP in USD is", (amount*1.20))
if choice == "4" and choice2 == "3":
print (amount, "GBP in EUR is", (amount*1.19))
Tekie.in
print("Welcome to Circle area and circumference calculator!")
radius=float(input("Enter the radius of the circle:"))
area=3.14*radius*radius
circumference=2*3.14*radius
print("AREA = "+str(round(area,2))+"\nCIRCUMFERENCE = "+str(round(circumference,2)))
Tekie.in
Tekie.in
print("Welcome to maths operation")
print("You can select any of the maths operation")
print("A - addition")
print("S - subtraction")
print("M - multiplication")
print("D - division")
print("P - percentage")
choice=input("Choose an option from above list:")
if choice =="M":
a=input("Type your first number for multiplication:")
b=input("Type your second number for multiplication:")
c=int(a)*int(b)
print("%s is your answer" %c)
elif choice =="D":
d=input("Type your first numder for Divition:")
e=input("Type your second number for Divition:")
f=int(d)/int(e)
print("%s is your answer" %f)
elif choice =="S":
g=input("Type your first number for substaction:")
h=input("Type your second number for sustaction:")
i=int(g)-int(h)
print("%s is your answer" %i)
elif choice =="A":
j=input("Type your first number for addition:")
k=input("Type your second number for addition:")
l=int(j)+int(k)
print ("%s is your answer" %l)
elif choice =="P":
m=input("Type your first number for modulus or percentage")
n=input("Type your second number for modulus or percentage ")
o=int(m)%(n)
print("%s is your answer" %o)
else:
print("Invaid Input")
Tekie.in
print("Hello, and welcome to the temperature converter.")
print("""Type :
( 1 ) - For ( Celsius ) --> ( Fahrenheit )
( 2 ) - For ( Fahrenheit ) --> ( Celsius )
( 3 ) - For ( Celsius ) --> ( Kelvin )
( 4 ) - For ( Kelvin ) --> ( Celsius )
( 5 ) - For ( Fahrenheit ) --> ( Kelvin )
( 6 ) - For ( Kelvin ) --> ( Fahrenheit )\n""")
choice = input()
if choice == "1":
print("Enter the temperature in Celsius : ")
temp = int(input())
temp = temp * 9 / 5 + 32
print("Degrees Fahrenheit : ", int(temp))
elif choice == "2":
print("Enter the temperature in Fahrenheit : ")
temp = int(input())
temp = (temp - 32) * 5 / 9
print("Degrees Celsius : ", int(temp))
elif choice == "3":
print("Enter the temperature in Celsius: ")
temp = int(input())
temp += 273
print("Degrees Kelvin : ", int(temp))
elif choice == "4":
print("Enter the temperature in Kelvin: ")
temp = int(input())
temp -= 273
print("Degrees Celsius : ", int(temp))
elif choice == "5":
print("Enter the temperature in Fahrenheit: ")
temp = int(input())
temp = (temp - 32) * 5 / 9 + 273
print("Degrees Kelvin : ", int(temp))
elif choice == "6":
print("Enter the temperature : ")
temp = int(input())
temp = (temp - 273) * 9 / 5 + 32
print("Degrees Fahrenheit in Kelvin: ", int(temp))
Tekie.in
print("MathHomework.py")
# Ask the user to enter a math problem
problem = input("Enter a math problem, or 'q' to quit: ")
# Keep going until the user enters 'q' to quit
while (problem != "q"):
# Show the problem, and the answer using eval()
print("The answer to ", problem, "is:", eval(problem) )
# Ask for another math problem
problem = input("Enter another math problem, or 'q' to quit: ")
# This while loop will keep going until you enter 'q' to quit
Tekie.in
Hi Python friends! So, today I made a currency converter... Where I can convert US Dollar to Indian Rupee and Indian Rupee to US Dollar... Try this code.... It is super fun... Bye!!!
print("Hello, and welcome to the currency converter.")
print("""Type:
(1) - For ( US Dollar ) --> ( Indian Rupee )
(2) - For ( Indian Rupee ) --> ( US Dollar )\n""")
choice = input()
if choice == "1":
print("Enter the currency in US Dollar : ")
curr = int(input())
curr = curr * 74.42
print("Currency Indian Rupee : ", int(curr))
elif choice == "2":
print("Enter the currency in Indian Rupee : ")
curr = int(input())
curr = curr * 0.013
print("Currency US Dollar : ", int(curr))
Tekie.in
Test your knowledge on animals.
a=input("please enter your name:")
print(f'''hello {a}!
Welcome to the quizer where
you can test your knowledge on animals''')
b=input("""please type start in small letters to start
the quiz.""")
if b=="start":
print("What is the animal with the longest tail?(Please type all answers in small letters.)")
c=input()
if c=="spider monkey":
print("correct answer!")
else:
print("wrong answer.")
print("What is the fastest bird?")
d=input()
if d=="Peregrine falcon":
print("correct answer!")
else:
print("wrong answer.")
print("What is the most popular bird?")
e=input()
if e=="chicken":
print("correct answer!")
else:
print("wrong answer.")
print("What is the biggest animal in the world?")
f=input()
if f=="blue whale":
print("correct answer!")
else:
print("wrong answer.")
print("How much would you rate this code")
g=input()
if g=="5 stars":
print("thank you for your rating!")
else:
print("wrong answer!")
Tekie.in
'''
TIC TAC TOE
PLAYER VS COMPUTER
'''
import random
player_1 = input("Enter player 1 name : ")
player_2 = 'James'
print(f'Player 2 name(pc) is {player_2}')
game = True
winner = "none"
count = 0
slots = [1,2,3,4,5,6,7,8,9]
mode = input('Which mode do you want to play in Easy, Medium or Hard(unbeatable) : ')
#assign characters "x or o"
player1_character = input(f"{player_1} what character do you want (x or o) : ")
if player1_character == "x":
player2_character = "o"
else:
player2_character = "x"
player1_character = "o"
#who will go first
whoWillGoFirst = random.randint(1,2)
if whoWillGoFirst == 1:
print(f"{player_1} will go first\n{player_2} will go second")
else:
print(f"{player_2} will go first\n{player_1} will go second")
board = [" "," "," "," "," "," "," "," "," "," "]
#making the board
def board_game():
print(' | |')
print(' ' + board[0] + ' | ' + board[1] + ' | ' + board[2])
print(' | |')
print('-----------')
print(' | |')
print(' ' + board[3] + ' | ' + board[4] + ' | ' + board[5])
print(' | |')
print('-----------')
print(' | |')
print(' ' + board[6] + ' | ' + board[7] + ' | ' + board[8])
print(' | |')
# making functions for player 1 turn and player 2
def player1_turn():
position = int(input(f"{player_1} which position do you want to place your character (1 to 9)"))
position = position - 1
if board[position] == " ":
board.pop(position)
board.insert(position,player1_character)
print("the board has been updated")
board_game()
else:
print("the slot has been taken")
player1_turn()
def ran():
position = random.choice(slots)
if board[position] == " ":
board.pop(position)
board.insert(position,player2_character)
print("the board has been updated")
board_game()
else:
ran()
#medium
def ai_turn_nor():
position = 10
stop = random.randint(1,2)
if stop == 1:
if board[0] == player1_character and board[1] == player1_character:
position = 2
elif board[1] == player1_character and board[2] == player1_character:
position = 0
elif board[0] == player1_character and board[2] == player1_character:
position = 1
elif board[3] == player1_character and board[4] == player1_character:
position = 5
elif board[4] == player1_character and board[5] == player1_character:
position = 3
elif board[3] == player1_character and board[5] == player1_character:
position = 4
elif board[6] == player1_character and board[7] == player1_character:
position = 8
elif board[7] == player1_character and board[8] == player1_character:
position = 6
elif board[6] == player1_character and board[8] == player1_character:
position = 7
elif board[0] == player1_character and board[4] == player1_character:
position = 8
elif board[4] == player1_character and board[8] == player1_character:
position = 0
elif board[0] == player1_character and board[8] == player1_character:
position = 4
elif board[2] == player1_character and board[4] == player1_character:
position = 6
elif board[4] == player1_character and board[6] == player1_character:
position = 2
elif board[2] == player1_character and board[6] == player1_character:
position = 4
elif board[0] == player1_character and board[3] == player1_character:
position = 6
elif board[3] == player1_character and board[6] == player1_character:
position = 0
elif board[0] == player1_character and board[6] == player1_character:
position = 3
elif board[1] == player1_character and board[4] == player1_character:
position = 7
elif board[4] == player1_character and board[7] == player1_character:
position = 1
elif board[1] == player1_character and board[7] == player1_character:
position = 4
elif board[2] == player1_character and board[5] == player1_character:
position = 8
elif board[5] == player1_character and board[8] == player1_character:
position = 2
elif board[2] == player1_character and board[8] == player1_character:
position = 5
else:
ai_turn_sim()
if position != 10:
if board[position] == " ":
board.pop(position)
board.insert(position,player2_character)
print("the board has been updated")
board_game()
else:
ran()
if stop == 2:
ai_turn_sim()
#hard
def ai_turn_hard():
position = 10
if board[0] == player2_character and board[1] == player2_character:
position = 2
elif board[1] == player2_character and board[2] == player2_character:
position = 0
elif board[0] == player2_character and board[2] == player2_character:
position = 1
elif board[3] == player2_character and board[4] == player2_character:
position = 5
elif board[4] == player2_character and board[5] == player2_character:
position = 3
elif board[3] == player2_character and board[5] == player2_character:
position = 4
elif board[6] == player2_character and board[7] == player2_character:
position = 8
elif board[7] == player2_character and board[8] == player2_character:
position = 6
elif board[6] == player2_character and board[8] == player2_character:
position = 7
elif board[0] == player2_character and board[4] == player2_character:
position = 8
elif board[4] == player2_character and board[8] == player2_character:
position = 0
elif board[0] == player2_character and board[8] == player2_character:
position = 4
elif board[2] == player2_character and board[4] == player2_character:
position = 6
elif board[4] == player2_character and board[6] == player2_character:
position = 2
elif board[2] == player2_character and board[6] == player2_character:
position = 4
elif board[0] == player2_character and board[3] == player2_character:
position = 6
elif board[3] == player2_character and board[6] == player2_character:
position = 0
elif board[0] == player2_character and board[6] == player2_character:
position = 3
elif board[1] == player2_character and board[4] == player2_character:
position = 7
elif board[4] == player2_character and board[7] == player2_character:
position = 1
elif board[1] == player2_character and board[7] == player2_character:
position = 4
elif board[2] == player2_character and board[5] == player2_character:
position = 8
elif board[5] == player2_character and board[8] == player2_character:
position = 2
elif board[2] == player2_character and board[8] == player2_character:
position = 5
else:
ai_turns_hard()
if position != 10:
if board[position] == " ":
board.pop(position)
board.insert(position,player2_character)
print("the board has been updated")
board_game()
else:
ai_turns_hard()
def ai_turns_hard():
position = 10
if board[0] == player1_character and board[1] == player1_character:
position = 2
elif board[1] == player1_character and board[2] == player1_character:
position = 0
elif board[0] == player1_character and board[2] == player1_character:
position = 1
elif board[3] == player1_character and board[4] == player1_character:
position = 5
elif board[4] == player1_character and board[5] == player1_character:
position = 3
elif board[3] == player1_character and board[5] == player1_character:
position = 4
elif board[6] == player1_character and board[7] == player1_character:
position = 8
elif board[7] == player1_character and board[8] == player1_character:
position = 6
elif board[6] == player1_character and board[8] == player1_character:
position = 7
elif board[0] == player1_character and board[4] == player1_character:
position = 8
elif board[4] == player1_character and board[8] == player1_character:
position = 0
elif board[0] == player1_character and board[8] == player1_character:
position = 4
elif board[2] == player1_character and board[4] == player1_character:
position = 6
elif board[4] == player1_character and board[6] == player1_character:
position = 2
elif board[2] == player1_character and board[6] == player1_character:
position = 4
elif board[0] == player1_character and board[3] == player1_character:
position = 6
elif board[3] == player1_character and board[6] == player1_character:
position = 0
elif board[0] == player1_character and board[6] == player1_character:
position = 3
elif board[1] == player1_character and board[4] == player1_character:
position = 7
elif board[4] == player1_character and board[7] == player1_character:
position = 1
elif board[1] == player1_character and board[7] == player1_character:
position = 4
elif board[2] == player1_character and board[5] == player1_character:
position = 8
elif board[5] == player1_character and board[8] == player1_character:
position = 2
elif board[2] == player1_character and board[8] == player1_character:
position = 5
else:
ran()
if position != 10:
if board[position] == " ":
board.pop(position)
board.insert(position,player2_character)
print("the board has been updated")
board_game()
else:
ran()
#making function that will check winner
def winnerCheck():
global game
global winner
global count
if (board[0] == "x" and board[1] == "x" and board[2] == "x"
or
board[3] == "x" and board[4] == "x" and board[5] == "x"
or
board[6] == "x" and board[7] == "x" and board[8] == "x"
or
board[0] == "x" and board[4] == "x" and board[8] == "x"
or
board[2] == "x" and board[4] == "x" and board[6] == "x"
or
board[0] == "x" and board[3] == "x" and board[6] == "x"
or
board[1] == "x" and board[4] == "x" and board[7] == "x"
or
board[2] == "x" and board[5] == "x" and board[8] == "x"):
if player1_character == "x":
print(f"\n{player_1} wins the match")
game = False
else:
print(f"\n{player_2} wins the match")
game = False
elif (board[0] == "o" and board[1] == "o" and board[2] == "o"
or
board[3] == "o" and board[4] == "o" and board[5] == "o"
or
board[6] == "o" and board[7] == "o" and board[8] == "o"
or
board[0] == "o" and board[4] == "o" and board[8] == "o"
or
board[2] == "o" and board[4] == "o" and board[6] == "o"
or
board[0] == "o" and board[3] == "o" and board[6] == "o"
or
board[1] == "o" and board[4] == "o" and board[7] == "o"
or
board[2] == "o" and board[5] == "o" and board[8] == "o"):
if player1_character == "o":
print(f"\n{player_1} wins the match")
game = False
else:
print(f"\n{player_2} wins the match")
game = False
else:
if count == 9:
print("tie")
game = False
return game
#main game
if mode.lower() == 'easy':
while game == True:
if whoWillGoFirst == 1:
player1_turn()
count = count + 1
winner_check = winnerCheck()
if winner_check == False:
break
ran()
count = count + 1
winner_check = winnerCheck()
if winner_check == False:
break
else:
ran()
count = count + 1
winner_check = winnerCheck()
if winner_check == False:
break
player1_turn()
count = count + 1
winner_check = winnerCheck()
if winner_check == False:
break
if mode.lower() == 'medium':
while game == True:
if whoWillGoFirst == 1:
player1_turn()
count = count + 1
winner_check = winnerCheck()
if winner_check == False:
break
ai_turn_nor()
count = count + 1
winner_check = winnerCheck()
if winner_check == False:
break
else:
ai_turn_nor()
count = count + 1
winner_check = winnerCheck()
if winner_check == False:
break
player1_turn()
count = count + 1
winner_check = winnerCheck()
if winner_check == False:
break
if mode.lower() == 'hard':
print(whoWillGoFirst)
while game == True:
if whoWillGoFirst == 1:
player1_turn()
count = count + 1
winner_check = winnerCheck()
if winner_check == False:
break
ai_turn_hard()
count = count + 1
winner_check = winnerCheck()
if winner_check == False:
break
else:
ai_turn_hard()
count = count + 1
winner_check = winnerCheck()
if winner_check == False:
break
player1_turn()
count = count + 1
winner_check = winnerCheck()
if winner_check == False:
break
Tekie.in
This code will help you search in YouTube or google faster and easier. NOTE: THIS CODE ONLY WORKS ON PYTHON OR PYTHON IDE LIKE PYCHARM AND VISUAL STUDIO. YOU NEED TO ALSO INSTALL THE NEEDED PIP PACKAGES TO RUN THIS CODE. THE NEEDED COMMAND IS GIVEN ON THE CODE. please like my code toooo......
from googlesearch import * #pip install googlesearch
import pywhatkit #pip install pywhatkit
import webbrowser #pip install webbrowser
print("Hi I am Chithranjan in this code you can search in youtube or google faster and easier")
print("So what would you like to open google or youtube type in small letters")
choice = input("Youtube or google")
if choice == 'google':
print("What would you like to search in google")
query = input("WHat do you want me to search:")
chrome_path = r'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe %s'
for url in search(query, tld="co.in", num=1, stop = 1, pause = 2):
webbrowser.open("https://google.com/search?q=%s" % query)
print("opening google")
if choice == 'youtube':
song=input("What do you want to play in youtube")
print("Playing" +song)
pywhatkit.playonyt(song)
print("Thank you for using this code")
print('I would really appreciate if you like this code')