Fox76

Members
  • Content Count

    41
  • Joined

  • Last visited

  • Days Won

    4

Fox76 last won the day on July 31 2018

Fox76 had the most liked content!

4 Followers

About Fox76

  • Rank
    Advanced Member
  • Birthday July 6

Profile Information

  • Gender
    Male
  • Location
    01001110 01011001

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I don't have the Python IDLE atm but I believe what you want to do is this: Print("CSC 122 Program #3") Print("By Cody Garner") Print("Due Sunday Oct. 11th") W = input(" Enter the weight of the package: ") # Be careful you used w instead of W this is case sensitive # you also added a single double quote at the end of some of your if statements which is not needed # using w == <= 2 is an error what its trying to do is this # is w equal to less than equal to 2? # you're basically comparing a comparison to another comparison which will give an error # this fixed code now reads 'is W less than or equal to 2?' if (W <= 2): print("1.50") # I explain the fix to this below if (W >= 2 and W <= 6): print("3.00") # You don't need the W == >= 6 this translates to # if W is equal to greater than equal to 6 # also when you use 'and' the program looks for two things # (condition) and (condition) if both are true then it executes # however your second condition is set as ( <= 10 ) # the problem is what is being tested? It doesn't know and will give an error # below is how this should be written: if (W >= 6 and W <= 10): print("4.00") if (W >= 10) print("4.75")
  2. Fixed, commented a few of the errors #include <iostream> #include <cstdlib> #include <time.h> #include <string> using namespace std; int main() { int greg, blalala, blala, blala2; // you initialized blala twice renamed the second to blala2 string name; string input; // moved from being local in your first if statement cout << "Please ENTER your name" << endl; cin >> name; system("cls"); // initialize greg to 1 so it will evaluate to true greg = 1; // you tried to use greg as a boolean while unitialized if (greg) { // string input; // input is local only to this if statement, move it outside the body of this if cout << "Hello blala, my name is Char. I will be assisting you with your file. \n Searching... \n File Found" << endl; cout << "Press ENTER to view file" << endl; cin.ignore().get(); system("cls"); // Showing Greg's File cout << "File 01" << endl; cout << "*******" << endl; cout << "blalalalalalalalalalal " << endl; cout << "blalalal" << endl; cout << "blalalalalalallalalalalal " << endl; cout << "blalalalalallal " << endl; cout << "blalalalalalala " << endl; cout << "balalalallaalallala " << endl; cout << "blalalalalalalalala " << endl; cout << "\nWould you like to read the biography\n"; cout << " Yes No " << endl; cin >> input; } // you added a ; after your if condition which is an error if (input.compare("yes")) { system("cls"); cout << "Biography" << endl; cout << "*********" << endl; cout << "Press ENTER to go back to main menu" << endl; cin.ignore().get(); return main(); } // you added a ; after your else if condition which is an error else if (input.compare("no")) { system("cls"); return main(); } return main(); }
  3. If you haven't yet I would recommend looking into the C++ series for now, for programming it's best to learn multiple languages as many of them work together to accomplish certain complicated tasks. However C++ is one of the top programming languages, what you want to do is kind of ambitious but I would recommend C++, though that isn't to say another language couldn't do the same task, but it's the one I would say to learn next.
  4. If your account is an administrator then when you right click on an exe there is usually an option that says "Run as administrator". You can also try right clicking it, selecting properties and there should be a tab like "Compatiblity" with an option you can select that says something along the lines of "Run this program as an administrator". Select it and that should take care of your access denied issue, btw I run Win7 and this is how you give administrator rights to programs, it should be similar for you.
  5. Fox76

    n00b

    Welcome to the forums, if you run into any problems on the tutorials or need any clarification on certain parts we'll be here. Though it may take a little while for a response, we'll do our best to get back to you.
  6. Fox76

    Hello

    Welcome, if you have any questions feel free to ask. Also as a side note if you have any programming issues be sure to post the code that's giving you the trouble, it makes it easier for us to help troubleshoot your issue and point you in the right direction. Again welcome to the forums :)
  7. Firstly I'm not sure if this was a copy/paste error but is your code indented where python expects an indented code block? (Such as defining your functions, ifs and else statements) If your indentation is ok then I would suggest checking lines 26 through 33 in your main function again, as this is where your errors appear when running it. Check for the following errors: 1. Missing opening and closing parentheses ( ) 2. Indentation errors 3. Spelling errors in variables 4. Missing colon : 5. Missing quotes " " Two or three of those are causing you your issue, if you want to recheck it and figure it out on your own check between those lines in your code for those errors. If you still can't find it, or just want to see what is wrong I posted the fixed code below and marked on the lines with ### that gave errors and the reason.
  8. Is the code indented after the While True? If not it hits While True and sees nothing in it's code block as the ifs and elses that come after it are on the same indentation as the While loop, so it will run once and then close and not loop as it reaches what it thinks is the end of your code.
  9. I run everything from Pythons IDLE, if while using Notepad++ you get an error typing input("what is your name?") and instead it works with raw_input it's because it's still using python2 and not python 3 even if its installed. Also the tutorials here are made using the newest version of python, python 3. The way things are coded in python 3 is a little different than python 2, so it will give you issues if you try to follow the tutorials with python 2. I haven't used Notepad++ but I can tell you the reason you're still getting the error is because it's still linked to your python 2, I suppose you could always just uninstall python 2.
  10. Yes very good, you could use a while loop to accomplish that. It would be something like so: # Set end to yes so we'll enter the while loop end = yes # As long as end is still equal to yes enter the loop while end == yes: # Put your game / code here # More code # ect, ect # make a condition / statement somewhere in the code where # end will be set to something other than yes so it exits the loop. # Put code here when you are out of the loop that you want run when # you are out of the while loop due to end not being equal to yes. If you run into issues while making your text based game or have other questions or need more clarification let us know.
  11. Well I could tell you some things that would probably help, understanding program flow and execution of code, being able to analyze and detect software issues and errors, recording data for a follow up fix/maintenance. Programs are prone to bugs, basically it sounds like they want a tester who is already skilled at troubleshooting and finding issues and has probably had an IT position before doing just that, at least that's what I'm assuming from that description.
  12. I've never had to write a CSV file before, but if you want to be pointed in the right direction I would recommend reading this link here http://java.dzone.com/articles/python-101-reading-and-writing and sorry it took awhile to respond, if you have other questions just ask.
  13. We all have to start somewhere, as long as you keep trying to learn and code things on your own and discover new ways to create programs, then you'll eventually be the one helping others and passing on knowledge. Never stop learning and trying new things, after all you can't really break a program so bad it can't be fixed, best way to learn is to just try it and learn from any mistakes, as my teacher said "the life of programming is filled with errors" lol.
  14. Alright I edited it and used msvcrt with getch this time so you can see. The way I did it before accepts any input entered but won't respond to things like the esc key being pressed, with getch now even if esc key and any other, ect is pressed it will respond and continue. I also added in a rough check for the users input to see if they entered a number, if at any point a character was entered it will re-prompt the user to enter numbers only. The check I added uses indexing, a while loop, a for loop and ord which checks each entered character to it's ASCII code in the decimal index. The modified code is posted below with commenting to help you understand what it's doing at certain points in the code, again most of this hasn't been taught yet. import time # import time for sleeping the script import msvcrt # import msvcrt for getting what key was pressed def incorrG(): # If the guess is incorrect print("wrong, enter to continue") c = msvcrt.getch() # This will pause until any key is pressed then continue def question(): leg = 11 # You don't have to put int(11) as 11 is already an integer, but it doesn't hurt anything. while True: # Main loop # We're changing this, their answer will be stored as a string. myAnswer = input("how many legs do I have: ") check = 1 # We set check to 1 for our next while loop. while check == 1: # Here we're going to check if what they entered was a number. # This for loop will get the length of myAnswer (how many characters were typed) # and check the first character then the next then the next until their entire answer # has been checked. for i in range(0, len(myAnswer)): # This uses indexing, it's like a search, it checks the 1st character of myAnswer # Then i is incremented so it will check the next character (index) in myAnswer # and it stores it in a variable char each time. char = myAnswer[i] # This uses ASCII, ord changes a character to it's ASCII number # the ASCII numbers 48 - 57 are numbers 0 - 9 on the keyboard. # So if at any point in myAnswer there is a character entered that isn't a number. # it will go to the else statement and prompt them to enter numbers only and keep looping. if ord(char) >= 48 and ord(char) <= 57: check = 0 # Set check to 0, it will stay 0 and get us out of the loop as long as no non number is found. else: print('please enter only numbers') check = 1 # If a non number is found change check to 1 and stay in the loop. myAnswer = input("how many legs do I have: ") break # break out of the for loop as a non number was found and recheck the new answer. if int(myAnswer) == leg: # Change myAnswer to an integer and compare it to leg. print("damn right!") print("loading...") time.sleep(1) break elif int(myAnswer) != leg: print("dude you're digressing, try again") incorrG() question()
  15. Fixed, as Kevin mentioned there were some indentation errors, if you want go back and try to fix any indentation errors for practice or scroll down and see what I did. I also changed the incorrG() function to something simple, the user can input anything and it will break out of the loop and continue, I prefer something like that when just doing a text based game. Simple and not a lot of coding, or maybe I'm just lazy lol. Click show for my work around fix: