Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ErrorHunter
Submodule ErrorHunter added at 956b48
17 changes: 8 additions & 9 deletions FunProjects/directions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,18 @@ def reduce_dir(directions):
stack = []

for d in directions:
if stack and opposite[d] == stack[-1]:
if stack and opposite[d] == stack[0]:




stack.pop()
stack.pop()
stack.pop()
print(stack.pop())


else:


stack.append(d)

return stack

directions = ["NORTH", "SOUTH", "SOUTH", "EAST", "WEST", "NORTH", "WEST"]


reduce_dir(directions)

70 changes: 35 additions & 35 deletions FunProjects/quiz_main.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,33 @@
# Technology Quiz in Python

import time

def pause(seconds):

time.sleep(seconds)

def ask_question(question):

answer = input(question + "\nAnswer = ")
answer = input(question + "\nAnswer = ").strip().upper()
return answer

def evaluate_question(user_answer, correct_answer, alt_answer, close_answer):
if user_answer == alt_answer:
return True
elif user_answer == correct_answer:
return True
elif user_answer == close_answer:
return "Close"

if user_answer == correct_answer:
return False
elif user_answer in alt_answer:
return False
elif user_answer in close_answer and close_answer:
return "Close"
else:
return True

def answer_response(evaluated):

if evaluated == True:
return "That's not the correct answer!"
return "Oops! That's not the correct answer!"
elif evaluated == "Close":
return "Close! But not quite right. Try again!"
else:
return "Correct! Well done."
return "Correct! Well done."

correct_answers = 0

answer_index = 1
answer_index = 0

questions = [
"Solar power generates electricity from what source?",
Expand Down Expand Up @@ -107,37 +103,41 @@ def answer_response(evaluated):
print("Let's begin the quiz.")
pause(2)


for question in questions:
answer = ask_question(question)
evaluated = evaluate_question(answer, answers[answer_index], alt_answers[answer_index], close_answers[answer_index])


while evaluated == "Close":
pause(1)

answer = ask_question(questions[answer_index])
print(close_responses[answer_index])
answer = ask_question(question)
evaluated = evaluate_question(answer, answers[answer_index], alt_answers[answer_index], close_answers[answer_index])
if evaluated:



if evaluated == False:
correct_answers += 1
pause(1)


print(answer_response(evaluated))
answer_index += 2

answer_index += 1
pause(2)

if correct_answers == 1:
question_amount = "question"
else:
question_amount = "questions"

print("Thanks for taking this quiz, {}.".format(user_name))
print(f"Thanks for taking this quiz, {user_name}.")
pause(2)


if correct_answers == 10:
print("Congratulations, you got all 10 questions correct and have been awarded the gold medal!")
elif correct_answers > 6 and correct_answers < 10:

print("Congratulations, you got {} questions correct and have been awarded the bronze medal!".format(correct_answers))
elif correct_answers > 0 and correct_answers < 6:
print("Congratulations, you got {} {} correct and have been awarded the silver medal!".format(correct_answers, question_amount))
elif 10>correct_answers >=6:
print(f"Congratulations, you got {correct_answers} questions correct and have been awarded the silver medal!")
elif 5>=correct_answers > 0:
print(f"Congratulations, you got {correct_answers} questions correct and have been awarded the bronze medal!")
else:

print("Take the quiz again to try to earn a medal!")
print("Take the quiz again to try and earn a gold medal!")



14 changes: 9 additions & 5 deletions FunProjects/rockPaperSiss.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ def rock_paper_scissors():
if user_choice not in choices:
print("Invalid choice! Try again.")
continue

import random
computer_choice = random.choice(choices)
print(f"Computer chose: {computer_choice}")

if user_choice == computer_choice:
print("It's a tie!")
print("AHAHAH It's a tie! I challenge you for next round human !" )
print("Accept or Afraid")
elif (user_choice == "rock" and computer_choice == "scissors") or \
(user_choice == "scissors" and computer_choice == "paper") or \
(user_choice == "paper" and computer_choice == "rock"):
Expand All @@ -25,15 +26,18 @@ def rock_paper_scissors():
def main():
while True:
print("\nMenu:")
print("1. Play Rock, Paper, Scissors")
print("2. Exit")
print("1. I Changelle you to play Rock, Paper, Scissors")
print ("2. Accept")
print("3. Reject")

choice = input("Enter your choice: ")

if choice == "1":
rock_paper_scissors()
elif choice == "2":
print("Thanks for playing!")
rock_paper_scissors()
elif choice == "3":
print("Are you afraid of me ?")
break
else:
print("Invalid choice! Please try again.")
Expand Down
13 changes: 1 addition & 12 deletions problems/easy/easy_q1.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,13 @@

num = int(input("Enter a number: "))


if num % 2 != 0:
print("{0} is odd".format(num))
else:
print("{0} is even".format(num))


if (num % 2) == 0:
print("{0} is Even".format(num))
else:
print("{0} is Odd".format(num))


if (num % 2) != 0:
print("{0} is Odd".format(num))
else:
print("{0} is Even".format(num))





38 changes: 7 additions & 31 deletions problems/easy/easy_q2.py
Original file line number Diff line number Diff line change
@@ -1,48 +1,24 @@
# Find the Largest Number: Accept two numbers and print the larger one.
def largest_of_two(a, b):
if a > b:
return b

return a
else:
return a

else:
return b

if __name__ == "__main__":
num1 = int(input("Enter the First Number :"))
num2 = int(input("Enter the Second Number :"))
res = largest_of_two(num1,num2)

print(res)

print(res)

print(num1,"larger")
else:
print(num2,"larger")

if __name__ == "__main__":
num1 = int(input("Enter the First Number :"))
num2 = int(input("Enter the Second :"))
res = largest_of_two(num1,num1)
print(res)


return a
res = largest_of_two(num1,num2)

return a

else:
return b
if __name__ == "__main__":
num1 = int(input("Enter the First Number :"))
num2 = int(input("Enter the Second Number :"))
res = largest_of_two(num1,num2)
keerthi
print("The Largest Number is",res)


print(res)


main




50 changes: 25 additions & 25 deletions problems/medium/m1.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
'''
Create a menu to perform basic mathematical operations (addition, subtraction, multiplication, division, modulo) on two numbers.

'''
choice=int(input("Enter no. of choice:"))
def math_operations_menu(choice):
a, b = map(int, input("Enter two numbers(separated by commas): ").split(sep=","))


if choice == 2:
print("Subtraction:", a - b)
elif choice == 1:
print("Addition:", a + b)
elif choice == 4:
print("Division:", a / b)
a, b = map(int,input("Enter two numbers(separated by commas): ").split(sep=","))
if choice == 1:
print(a + b)
elif choice == 2:
print(a - b)
elif choice == 3:
print("Multiplication:", a * b)

print(a * b)
elif choice == 4:
print(a / b)
elif choice == 5:
print(a % b)
elif choice == 6:
print(a ** b)

if choice == 1:
print(f"Subtraction of {a} and {b}:{a - b}")
print(f"Addition of {a} and {b}:{a + b}")
elif choice == 2:
print(f"Addition of {a} and {b}:{a + b}")
print(f"Subtraction of {a} and {b}:{a - b}")
elif choice == 3:
print(f"Division of {a} and {b}:{a / b}")
elif choice == 4:
print(f"Multiplication of {a} and {b}:{a * b}")
elif choice == 5:
print(f"Modulus of {a} and {b}:{a // b}")
elif choice == 4:
print(f"Division of {a} and {b}:{a / b}")
elif choice == 5:
print(f"Modulus of {a} and {b}:{a % b}")
elif choice == 6:
print(f"{a} to the power of {b}:{a**b}")
else:
print("Invalid option")
math_operations_menu()

print("Invalid option!!!")
math_operations_menu(choice)

print("-------------Mathematical operation menu---------------")
print("1. Add")
print("2. Subtract")
print("3. Multiply")
print("4. Divide")
print("5. Modulus")
print("6. Expontential")
choice = int(input("Enter your choice: "))
math_operations_menu(choice)


print("-------------------------------------------------------")