Search the Community

Showing results for tags 'beginner'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • General
    • Show Us Your Creations
    • Blog
    • Recommended Reading
  • One Stop Programming Tutorials
    • Python Beginner Series
  • Programming Languages
    • Python
    • C++
    • C#
    • Arduino
    • Other Languages

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 6 results

  1. Hey guys, I have been watching kjdelectronics on his python tutorial videos and have recently gotten to the part where you build a calculator, but I'm having trouble in the finalization process of it all. My code seems to be flawed - I keep getting a syntax error and have no idea why because I have copied the code exactly as he presents it in the video. I was wondering if anyone could look at it and tell me where my issue (bug) is located. Here is my code and a screenshot of the syntax error. #Returns the sum of num1 and num2 def add(num1, num2): return num1 + num2 #Returs the result of subtracting num1 - num2 def sub(num1, num2): return num1 - num2 #Returns the result of multiplying num1 * num2 def mul(num1, num2): return num1 * num2 #Returns the result of dividing num1 / num2 def div(num, num2): return num1 / num2 def main(): operation = input("What do you want to do? (+, -, *, /): ") if(operation != '+' and operation != '-' and operation != '*' and operation != '/'): #invalid operation print("You must enter a valid operation") else: var1 = int(input("Enter num1: ") var2 = int(input("Enter num2: ") if(operation == '+'): print(add(var1, var2)) elif(operation == '/'): print(div(var1, var2)) elif(operation == '-'): print(sub(var1, var2)) else: print(mul(var1, var2)) main()
  2. There seem to be a problem, which i can't find... I have a problem, where program won;t tell corectly if i won/lost/ tied.. please help, because it's eating my mind haha
  3. Hi, I am starting to use python and only have experience using MATLAB for many years, but otherwise I'm a newbie and have been solving roadblock after roadblock for days, and now I'm stuck here: I have installed python 3.6 , then anaconda, and am trying to use spyder with the pygame 1.9.3 64bit package. I installed the pygame whl in cmd. The error in spyder is "Kernel died, restarting". (runs OK in IDLE, but I want to use spyder). I'm all googled out. Any tips? Apologies for any wrong terminology
  4. hey guys, Im a newbie in python, with some experience in C++. Upon trying to install python, im still unable to access it from the command prompt. (I use a windows 8.1, DELL laptop) Anyone who can help, please reply, In case you have teamviewer, ill be more than happy to let access to my PC, to fix this problem. I have tried changing the Environment Variables as mentioned in the video, but the error persists. Regards Abhishek (An aspiring programmer)
  5. I wrote this piece of code for practice. I don't see what's wrong in it. Please help. def add(num1, num2): """This function adds the value of arguments given to it. Only works with two arguments""" return num1 + num2 def sub(num1, num2): """This function substracts the value of arguments given to it""" return num2 - num1 def mul(num1, num2): """ This function multiplies the value of arguments given to it""" return num1 * num2 def div(num1, num2): """ This function divides the value of arguments given to it""" return num2 / num1 def main(): num1 = input("What is num1?") num2 = input("What is num2?") my_result1 = add(num1, num2) my_result2 = sub(num1, num2) my_result3 = mul(num1, num2) my_result4 = div(num1, num2) print(my_result1) print(my_result2) print(my_result3) print(my_result4) main() This is the output that I am getting in debugger window - C:\Python35\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2\helpers\pydev\pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 63680 --file C:/Users/Dell/PycharmProjects/main.py/firststep.py pydev debugger: process 2028 is connecting Connected to pydev debugger (build 172.3317.103) What is num1?5 What is num2?10 Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2\helpers\pydev\pydevd.py", line 1596, in <module> globals = debugger.run(setup['file'], None, None, is_module) File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2\helpers\pydev\pydevd.py", line 1023, in run pydev_imports.execfile(file, globals, locals) # execute the script File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "C:/Users/Dell/PycharmProjects/main.py/firststep.py", line 25, in <module> main() File "C:/Users/Dell/PycharmProjects/main.py/firststep.py", line 17, in main my_result2 = sub(num1, num2) File "C:/Users/Dell/PycharmProjects/main.py/firststep.py", line 6, in sub return num2 - num1 TypeError: unsupported operand type(s) for -: 'str' and 'str' Process finished with exit code 1
  6. I'm a beginner, just started learning python yesterday and I'm trying to build this little heads or tails text-based game. Little Game - Copy.txt Te code is attached. Had to upload it in .txt format because the page doesn't allow me to upload it in .py format. The problem I'm having is that I can't figure out how to make it random, I only got the results to alternate. For example, if I keep putting heads, in the first try I get it right, in the second one I get it wrong, in the third I get it right and so on. The same happens with tails. So please help me out and teach me a way to make it random. Thank You