This is one of the simplier projects that I have completed, so not as much need to keep asking chatGPT questions. Although, the study function on chatGPT can be helpful at times, I began to rely to heavily on it.
# Calculator
# Two numbers input from the console
number_one = int(input("Please enter a number: "))
number_two = int(input("Please enter a number: "))
add = "+"
subtract = "-"
multiply = "*"
division = "/"
selectoperand = input(f"Please choose an operator {add, subtract, multiply, division} ")
# function to add two numbers together
def Add(number_one, number_two):
total = number_one + number_two
# Does calculation
return total
Add(number_one, number_two)
#Added numbers stored in a variable
result = Add(number_one, number_two)
#Prints result
#-------------------------------------------------------
def Subtract(number_one, number_two):
total = number_one - number_two
return total
Subtract(number_one, number_two)
resultforsubtraction = Subtract(number_one, number_two)
#-------------------------------------------------------
def Multiply(number_one, number_two):
total = number_one * number_two
return total
Multiply(number_one, number_two)
resultformultiplication = Multiply(number_one, number_two)
def Division(number_one, number_two):
total = number_one / number_two
return total
Division(number_one, number_two)
resultfordivision = Division(number_one, number_two)
if selectoperand == "+":
print(result)
elif selectoperand == "-":
print(resultforsubtraction)
elif selectoperand == "*":
print(resultformultiplication)
elif selectoperand == "/":
print(resultfordivision)

so any beginners like super beginners use this. it is so fun i was just so burned out (i am a beginner ).i just learned upto dictionaries and tuples . then i learned about pip , venv etc and i again find learning python so fun.thanks for everyone who suggested me this.
EDIT: By interactive python I mean learning python in a more hands-on way instead of just writing .py files and running them once.
What I used:
VS Code + Python extension
Jupyter support in VS Code (this helped A LOT)
Virtual environments (venv)
pip (package manager)
Using Jupyter / interactive cells lets you run code line by line, see output instantly, test things quickly, and not get burned out.
After learning basics like lists, dicts, tuples, this made python feel fun again for me.
I’m still a beginner, but this really helped
EDIT: many of you guys are asking me about which video so i was just watching this video and at the start while setting my vscoe i got to know these things
i've created this function to count hand value. AI says it is incorrect and I cannot see why.
def score(hand):
score = 0
aces_count = []
for card in hand:
if card != 11:
score += card
for card in hand:
if card == 11:
aces_count.append(card)
for card in hand:
if card == 11:
if score < 10:
score += 11
elif score == 10:
if len(aces_count) > 1:
score += 1
else:
score += 10
else:
score += 1
return score