All Activity

This stream auto-updates     

  1. Today
  2. ive Joined your class. Thankyou kevin. im learning python thanks to you.
  3. Last week
  4. Python config.

    instead of typing python try just py
  5. Help, Unable to access python fro Cmd prompt

    instead of typing python just try py
  6. try typing just py instead of python
  7. Thanks for making these videos! They've been really helpful to me!
  8. Earlier
  9. School Project Help

    Hello everyone! I have an urgent problem that I am sure is pretty easy, but I have no experience with python and I have a project due soon. I have studied quite a bit this past week but i am still having trouble learning this. My project is this: A local department store hires you to write an automated checkout program designed specifically for their express checkout lane. The express lane is limited to five items for any one purchase. Write a simple program using Python that prompts the user for the prices of five individual items and then calculates and displays the subtotal, sales tax, and total. The sales tax is 6 percent. Any help at all would be greatly appreciated. Thank you
  10. Rock Paper Scissors Beginners practice

    Here's my updated version import random import time def opponentChoice(oppChoice): """Determines the opponents move""" if oppChoice == 0: print('Rock') elif oppChoice == 1: print('Paper') elif oppChoice == 2: print('Scissors') def outcomes(plyrChoice, oppChoice): """All the possible outcomes""" if plyrChoice == 'r' and oppChoice == 0: print('Stalemate!') elif plyrChoice == 'r' and oppChoice == 1: print('You lose!') elif plyrChoice == 'r' and oppChoice == 2: print('You win!') if plyrChoice == 'p' and oppChoice == 0: print('You win!') elif plyrChoice == 'p' and oppChoice == 1: print('Stalemate!') elif plyrChoice == 'p' and oppChoice == 2: print('You lose!') if plyrChoice == 's' and oppChoice == 0: print('You lose!') elif plyrChoice == 's' and oppChoice == 1: print('You win!') elif plyrChoice == 's' and oppChoice == 2: print('Stalemate!') def main(): """How the game runs""" for i in range(3): validInput = False while not validInput: plyrChoice = input('"r" for rock, "p" for paper, or "s" for scissors') if plyrChoice == 'r' or plyrChoice == 'p' or plyrChoice == 's': validInput = True else: print('Invalid input. Try again') continue oppChoice = random.randint(0, 2) print('1...') time.sleep(0.5) print('2...') time.sleep(0.5) opponentChoice(oppChoice) outcomes(plyrChoice, oppChoice) time.sleep(1) def run(): """Runs the game once and then again if the user enters 'y' or exits for any other value""" cont = True while cont == True: main() y_n = input('Continue? "y" for yes, "n" for no') if y_n != "y": return run()
  11. Rock Paper Scissors Beginners practice

    Here is my version of the game. Please tell me what you think / how I can improve it. I also want to make it so that if you win 2 of 3 times, its says you won the game. I tried doing it but couldn't get it to work. import random import time def main(): cont = True while cont == True: def opponentChoice(oppChoice): if oppChoice == 0: print('Rock') elif oppChoice == 1: print('Paper') elif oppChoice == 2: print('Scissors') def outcomes(plyrChoice): """All the possible combinations""" if plyrChoice == 'r' and oppChoice == 0: print('Stalemate!') elif plyrChoice == 'r' and oppChoice == 1: print('You lose!') elif plyrChoice == 'r' and oppChoice == 2: print('You win!') if plyrChoice == 'p' and oppChoice == 0: print('You win!') elif plyrChoice == 'p' and oppChoice == 1: print('Stalemate!') elif plyrChoice == 'p' and oppChoice == 2: print('You lose!') if plyrChoice == 's' and oppChoice == 0: print('You lose!') elif plyrChoice == 's' and oppChoice == 1: print('You win!') elif plyrChoice == 's' and oppChoice == 2: print('Stalemate!') for i in range(3): plyrChoice = input('"r" for rock, "p" for paper, or "s" for scissors') oppChoice = random.randint(0, 2) print('1...') time.sleep(0.5) print('2...') time.sleep(0.5) opponentChoice(oppChoice) outcomes(plyrChoice) time.sleep(1) y_n = input('Continue? "y" for yes, "n" for no') if y_n != "y": break main()
  12. I am quite new on python and I feel I'm learning. Thank you so much for these helpful videos.
  13. So I started watching your updated video guide to learning python and I'm brand new to coding. When I go to add the project interpreter there isn't anything there. Thanks!
  14. riff2.py can you please tell me why is this not running. I am not getting anything when I run this. its not asking for "what is num1"? or anything else. riff2.py
  15. Hi! I have a problem. I cant load python. I have installed everything in my computer system thing. My python map inside my local disk C:\Python36 and that is what I have been written in the system thing. So we i load python on CMD, PowerShell or IDLE i get the same message: C:\Users\Carl Johan>python 'python' is not recognized as an internal or external command, operable program or batch file. or C:\Users\Carl Johan>py Can't find a default Python. I have tested many things. Please help:)
  16. Rock Paper Scissors Beginners practice

    i tried to do this on my own ik its very messy but it seems to work fine until the console prints "game has glitched" for no reason. I know i wrote that part of the code but i don't know why it happens out of nowhere? code is attached rock paper scissors game.py
  17. HighLowGame

    does any body know a way to get this program to stop with a user input. i try with a similar way with that videos, but i cant get it to work. does any body have any idea or a tip ?
  18. HighLowGame

    hey, I am new to programing and i have been messing around with python. i am trying to make a High Low guessing game. my goal is to have the user guess until they get it right, then once they guess it right it will restart or end. here is my code. sorry that it is messy. import random """cpu picks a random number""" num1 = (random.randint(1,10)) """helping keeping track of number of guesses""" """counter to keep track of number of guesses""" num2 = 0 "runs guessing game" def guessing_game(num2): goodgusse = False """used if user puts in wrong input""" validInput = False while not validInput: "gets user to pick a number between 1 and 10" while goodgusse == False: try: guess = int(input("what number am I thinking of between 1 and 10?")) num2 +=1 if (guess > (num1)): print ("too high") elif (guess < (num1)): print("too low") elif (guess == (num1)): print("you got it ") print("it took you " + str(num2) + (" times to get it right.")) print("it was " + str(num1)) break except ValueError: """ user is told they have to reenter the number.""" print("Invalid Input, try again.") guessing_game(num2)
  19. Is this the appropriate place to ask a question relative to the content of this video?
  20. when you will upload intermediate c++ videos

    It's been a bit longer than a few weeks, lol. I couldn't find them, did you post them to a different account or something?
  21. Connecting two source files. Need help.

    So i have been looking all over the internet trying different ways but none worked for me. I can't find a way to connect two source files (btw i am a noob to this.)
  22. Programm real configurators not visual

    Hi, I am Harald and work as programmer of 3D configurators in Realtime like on the following website. Actually I am only able to create virtual 3D configurators in Realtime. But I must learn the programming of real configurators. I need a tutorial to realize this. Which programming languages I must learn? C and C++? I am specialist in JavaScript at the moment. Thanks.
  23. Taylor Series of arctan x

    Hello everyone! I am facing some difficulties writing a python program for my school assignment. I am trying to write the taylor series for the arctangent function but i have difficulties getting the differentiation of f(x) done as well as to make the program continue on differentiating as the number of n terms increase. I have attached a photo of the formula and working as well. Any help will be greatly appreciated!
  24. where can I download windows SP1 for 32 bit?
  25. Rock Paper Scissors Beginners practice

    Ok.. sat down and thought about this 'rps' program and came up with a different approach... (… which is the best part of programming, there is no “one way”... you got the 'inputs'... you know what the 'output' requirements are... and everything in the middle is your playground.. ;) So.. for the Object Oriented Programming version of 'rps' the two areas that I focused on were: 1. User input... when 'we' plug in a value, we know that it's going to look like... when we rely on some 'other' human... there is no telling what the input is going to turn out to be. i.e. (“paper”,”Paper”,”PaPeR”,” pAaEr “, etc). So I wanted to change 'whatever' they entered into a single word with an initial capital letter and remove any spaces that may in front, impeded, or trailing. 2. The “runGame” section... was a massive “if, elif, elif, elif, elif...” making multiple 'test' within each stage... the successful result of which will define “self.winner” with the appropriate result. In 'this' programming example there are 9 conditions to check for... and, you can count on “Murphy” to have the majority of the conditions (not really... but it may feel like it) where “self.playerHand”=”scissors'”... and... “self.botHand”=”3”. You know why?... because that test is at the bottom of the list and you will have had to previously test “eight times” in vain before you get to the test to give you the correct 'answer' (… lot of CPU cycles...) To try to address this issue I added code in the runGame section which does the 'sanitation' of the user's input (self.playerHand) ... (probably should have created a 'new' value other than using self.playerHand... but it works). Within the __init__ section... I have added a dictionary called “combinations” with each possible 'index' defined along with it's 'result'. Within the runGame section... I have removed the massive if-elif block and replaced it with a call to the dictionary using the 'index', which is the user input plus botHand appended to it. So if the user enters “rock” and self.botHand=3... then the index will contain the string “Rock3”. If the user input is valid (rock, paper, scissors in some form) then I will be given the answer by the dictionary... if however, the user input is in the weeds (“xyzzy”), then it will create an exception and branch to “self.winner = 'INVALID input, try again'” Constructive criticisms always welcome... class Game: def __init__(self, newPlayerName): self.playerName = newPlayerName self.playerHand = "NA" self.botHand = "NA" self.winner = "No winner yet" self.combinations = {'Rock1':'You win','Rock2':'You tie','Rock3':'You lose', #rock combos 'Paper1':'You lose','Paper2':'You win','Paper3':'You tie', #paper combos 'Scissors1':'You tie','Scissors2':'You lose','Scissors3':'You win'} #scissor combs print("New instance of game class for " + self.playerName) def runGame(self): self.playerHand = str.title(str.replace(self.playerHand," ","")) #strip leading/trailing spaces # plus 1st character a Cap try: self.winner = self.combinations[self.playerHand + str(self.botHand)] #if input valid, winner set except: self.winner = 'INVALID input, try again' #something other than paper, rock, scissors entered def main(): myGame = Game('Kevin') print(myGame.playerName) print(myGame.playerHand) print(myGame.botHand) print(myGame.winner) myGame.playerHand = 'paper' myGame.botHand = 1 #Scissors myGame.runGame() print(myGame.winner) otherGame = Game('Zibzo') otherGame.runGame() print(otherGame.winner) main()
  26. Rock Paper Scissors Beginners practice

    my upgraded version of the game. def main(): import random botHand = random.randint(1, 3) userHand = input("Pick rock, paper or scissors ") print(username,'picked', userHand) if (botHand == 1): print("Computer picks scissors") elif (botHand == 2): print("Computer picks rock") elif (botHand == 3): print("Computer picks paper") import time time.sleep(1) if ((userHand == 'rock' or userHand == 'Rock') and botHand == 1): print(username, 'Won!') elif ((userHand == 'rock' or userHand == 'Rock') and botHand == 2): print('Game Tied!') elif ((userHand == 'rock' or userHand == 'Rock') and botHand == 3): print(username, 'Lost!') elif ((userHand == 'paper' or userHand == 'Paper') and botHand == 1): print(username, 'Lost!') elif ((userHand == 'paper' or userHand == 'Paper') and botHand == 2): print(username, 'Won!') elif ((userHand == 'paper' or userHand == 'Paper') and botHand == 3): print('Game Tied!') elif ((userHand == 'scissors' or userHand == 'Scissors') and botHand == 1): print('Game Tied!') elif ((userHand == 'scissors' or userHand == 'Scissors') and botHand == 2): print(username, 'Lost!') elif ((userHand == 'scissors' or userHand == 'Scissors') and botHand == 3): print(username, 'Won!') else: print('You can only pick [ rock ], [ paper ], or [ scissors ]') main() a = 1 username = 'As2C4HaaH21fg3V332Zsd' while (a < 2 or username == 'As2C4HaaH21fg3V332Zsd'): try: if (username == 'As2C4HaaH21fg3V332Zsd'): username = input("what is your name?") if (username != 'As2C4HaaH21fg3V332Zsd'): main() a = int(input('[Enter 1 For New Round] [Enter 2 For Last Round] [Enter 3 To Exit..]')) if (a == 1): print('Starting round') main() elif (a == 2): main() elif (a == 3): exit() elif (a != 3): a = int(input('Exit Game? [1]-Go Back [Other]-Exit Game')) else: main() except: while (a != 1 and a!= 2 and a != 3): try: a = int(input('Game Will Now Exit..')) finally: exit() while (a == 1): try: if (a == 1 and username !='none'): main() finally: main()
  27. Rock Paper Scissors Beginners practice

    I fixed your code. you put integer as a word when using the ' symbol. all you had to do was take them off.. lol def main(): import time import random bothand = random.randint(1,3) userHand = input("what do you pick rock, paper, scissors") print("You pick " + userHand) if bothand == 1: print("bot chose rock") elif bothand == 2: print("bot chose paper") elif bothand == 3: print("bot chose scissors") if ((userHand == 'rock') and bothand == 1): print ('you tie') elif ((userHand == 'rock') and bothand == 2): print ('you lose') elif ((userHand == 'rock') and bothand == 3): print ('you win') elif ((userHand == 'paper') and bothand == 1): print('you win') elif ((userHand == 'paper') and bothand == 2): print("you tie") elif ((userHand == 'paper') and bothand == 3): print("you lose") elif ((userHand == 'scissors') and bothand == 1): print("you lose") elif ((userHand == 'scissors') and bothand == 2): print("you win") elif ((userHand == 'scissors') and bothand == 3): print("you tie") else: print("invalid input") main() while (1 == 1): main()
  1. Load more activity