Search the Community

Showing results for tags 'help'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • General
    • Show Us Your Creations
    • Blog
    • Recommended Reading
    • SQUAD
  • 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


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 12 results

  1. It tells me that line 29 (the highlighted part) hasnt declared "cin" ([Error] 'cin' was not declared in this scope) I'd really like some help please. #include <iostream> #include <cstdlib> float addition(float num1, float num2) { return num1 + num2; } float subtraction(float num1, float num2) { return num1 - num2; } float multiplikation(float num1, float num2) { return num1 * num2; } float division(float num1, float num2) { return num1 / num2; } int main() { float num1; float num2; float choice; cout << "What would you like to do? \n 1= addition \n 2= subtraction \n 3= multiplikation \n 4= division"; cout << "choice: "; cin >> choice; if(choice==1) { //addition cout << "You're adding, enter the first number you would like to add. \nNumber1: "; cin >> num1; cout << "Now enter the second number. \nNumer2: " cin >> num2; cout << "The answer is: " << addition(num1, num1) << endl; } else { if(choice==2) { //subtraction cout << "You're subtracting, enter the first number you would like to subract. \nNumber1: "; cin >> num1; cout << "Now enter the second number. \nNumer2: " cin >> num2; cout << "The answer is: " << subtraction(num1, num1) << endl; } else { if(choice==3) { //multiplikation cout << "You're multiplying, enter the first number you would like to multiply. \nNumber1: "; cin >> num1; cout << "Now enter the second number. \nNumer2: " cin >> num2; cout << "The answer is: " << multiplikation(num1, num1) << endl; } else { if(choice==4) //division cout << "You're dividing, enter the first number you would like to divide. \nNumber1: "; cin >> num1; cout << "Now enter the second number. \nNumer2: " cin >> num2; cout << "The answer is: " << division(num1, num1) << endl; } } return 0; }
  2. Having trouble with the last problem on my python homework.Please help me on implementing what i am missing on the code. Here is what it says: Write a Python program that shows a turtle walking back and forth between two vertical walls. Please do the following: (a) Create a 800 X 600 Turtle Graphics window (b) Draw a vertical line at x-coordinate = -300. The y-coordinates of the two end points are 200 and -200, respectively. (c) Draw another vertical line at x-coordinate = 300. The y-coordinates of the two end points are 200 and -200, respectively. (d) Create a turtle object and change the shape from arrowhead to turtle. (e) Use a loop to make the turtle walk 2000 steps. Whenever the turtle hits a wall, it turns 180 degree and continues to walk. And here is what I've got down so far: import turtle turtle.setup(800,600) turtle1=turtle.Turtle() turtle1.penup() turtle1.setposition(-300, 120) turtle1.pendown() turtle1.setposition(-300, -120) turtle1.penup() turtle1.setposition(300, 120) turtle1.pendown() turtle1.setposition(300, -120) turtle1.penup() turtle1.setposition(0,0) for turtle in turtle1: turtle1.distance(2000) turtle1.degrees(180) turtle.exitonclick()
  3. 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)
  4. Hi I am having trouble programming a code for a school project. I am not very experienced with programming but try my best to learn. For the project I am using Python so that the code can work on my Rapsberry PI 3 Model B. The Raspberry Pi 3 will be connected to two trip sensors, four buttons, a LED light and display. The sytem works based on count. If the count is 0 then the LED light needs to be off. If the count is > 0 then the LED light needs to be on If the count is < 0 then the system needs to reset by bringing the count to 0 The two sensers will be placed next to each other to pick up in witch direction a moving object is going. Eg. when sensor one is triped and then sensor two, then the object goes in the positive direction and a count of one should be added, and when sensor 2 is triped and then sensor 1, then the object goes in the negative direction and a count of one should be subtracted. thus if sensor 1 and then sensor 2 is triggered then the count should +1 if sensor 2 and then sensor 1 is triggerd then the count should -1 The count needs to be shown on the LED screen Button 1 acts as the master switch to shut down or start up the sstem Button 2 should bring the count to 0 Button 3 should add 1 to the count Button 4 Should subtract 1 from the count Thank you for any and all help, I would gladly add you to my references to this project.
  5. I have no idea and I want to give a game to my friend without him downloading python and pygame just to be able to run the file. Also dont tell me change .py into a .exe that will not work
  6. I've been watching the Python Beginner Tutorial series on the Onestopprogramming youtube channel and in video 2, Kevin creates a new text file and renames it "" and changes the extension from .txt to .py. Then he's able to right click and press "Edit with Idle." When I rename the text file to nothing happens. I don't even get the popup asking if I'm sure I want to modify the extension. Can someone please help me? Link to the moment in the video below.
  7. Hey guys, i need some help if anyone is readily available. I am working on a program for a python class in school. I'm trying to write a basic program of shipping weights and how much the cost of each pound is. Now to the direct questions. One, am i able to put multiple if then statements into one line? Such as >6 and <10. If so, how would i do that? I will copy and paste my initial program to see if you guys can give me some help. Print("CSC 122 Program #3") Print("By Cody Garner") Print("Due Sunday Oct. 11th") W = input(" Enter the weight of the package: ") if (w == <=2): print("1.50") if (w == >=2 and <=6"): print("3.00") if (w == >=6 and <=10"): print("4.00") if (w == >=10") print("4.75") Please help ASAP. Thanks guys.
  8. Hey guys! Brand new to the site, and I'm just curious about one thing, I've been learning python for awhile now, and although so far ospPython has been working wonderfully, i've encountered an error that i'm not sure how to tackle. It seems that whenever I try to utilize argv, it just doesn't work. The reason I'm coming here with this problem is not only because i'm pretty sure this was the birthplace of ospPython, but it seems like a great, helpful community. so if anyone could offer advice, and even just tell me if i'm simply entering it wrong, i'd greatly appreciate it. My simple program, taken from "Learn Python the Hard Way", exercise 14, will be posted below, along with how I enter it into the command line; from sys import argv script, user_name = argv prompt = '> ' print "Hi %s, I'm the %s script." % (user_name, script) print "I'd like to ask a few questions, if that's alright with you." print "Do you like me %s?" % user_name likes = raw_input(prompt) print "Where do you live %s?" % user_name lives = raw_input(prompt) print "What kind of computer do you have?" computer = raw_input(prompt) print """ alright, so you said %r about liking me. you live in %r. Not sure where that is. and you have a %r computer. Nice. """ % (likes, lives, computer) ---------------------------------------------------------- PS C:\Users\Brennan\desktop\".py files"\PTHW> ospPython <any script name> <any name> thanks again!
  9. Hey everyone, I recently joined the programming game and this blog as well, which I found very helpful along with the creator of the website uploading videos on YouTube. I have come to understand quite a bit so far myself but there are some questions I want cleared by some of you guys who have been programming for some time now...Those questions are.. What method am I suppose to use to learn c++? More precisely, should I be writing down the codes I've seen so far on paper to be able to more easily use and implement in the program? Or will it all come by constant exposure, and proceeding on with the tutorial videos?..I feel like learning the videos and following up with onestopprogrammer's material shown in the video is a good, but if I come out and try to use what he did in the video on my own to build a calculator foresay all by myself, can prove quite difficult. For example, sometimes I would erase stuff to find out what they did as in a trial and error format to help me create the understanding of basics. Also, its probably better to put it out that I have started only 2 days ago and have probabbbly done better than others based on the questions they were asking in the comment section on YouTube.. Thanks Everyone! P.S --I am also a mechanical engineering student, and hopefully I can build a strong community base on this website so me and a few of you guys, whomever interested can work on a nice project in the near future as I improve on my c++ programming skills.
  10. Ironmxiden


    def add(dumb, dumb2) : return dumb + dumb2 def mul(dumb, dumb2) : return dumb * dumb2 def div(dumb, dumb2) : return dumb / dumb2 def sub(dumb, dumb2) : return dumb - dumb2 def ext(dumb, dumb2) : return dumb*dumb*dumb2 def main( ) : #i want to run from here to var1 = float(input('enter number 1 :')) var2 = float(input('enter number 2 :')) operation = input("What do want to do (+,-,*,/,$, ) :") if(operation != '+' and operation != '-' and operation != '*' and operation != '/' and operation !='$' ) : print 'placeholder' else: if(operation == '+') : print ( add ( var1, var2 ) ) elif(operation == '*') : print (mul(var1, var2)) elif(operation == '/') : print (div(var1, var2)) elif(operation == '-') : print (sub(var1, var2)) elif(operation == '$') : print (ext(var1, var2)) #to here main( ) I am a newb who just started today and I want to be able to repeat the code in an efficient way (not by redoing the code all over again) how can I do this EDIT: this May appear to not have any indents that's because I'm on mobile and it word wrapped but I can tell you this works
  11. Hi guys. I have been learning the basics of c++ from Kevin's tutorials, and I have a big question. What does #include <string> really do? String is a variable, so why isn't it inherent of c++? Why do you have to include the string libraries? Thanks.
  12. Hi does anyone know what this error message means or why I am getting it? C:\Users\Dean\Desktop>python Hello World What is your name?Dean Traceback (most recent call last): File "", line 2, in <module> myName = input("What is your name?") File "<string>", line 1, in <module> NameError: name 'Dean' is not defined I am using Notepad++ to do the editing and this is what I have typed in so far, pretty straight forward right..? print("Hello World") myName = input("What is your name?") print(myName) I have the .py file saved on my Desktop as you can see and there doesn't appear to be any error on my behalf. I've been following the video correctly (I think).