Search the Community

Showing results for tags 'Code'.



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 3 results

  1. So I ve been learning Python for a couple weeks and ran across this learning series. I coded a little of my own and I need some input. It runs but I am not for sure how to clean it up. Visual Studio gives me suggestions to make it all one def, am confused. not for sure if suppose to upload file or just post the code so please inform me the correct way. Not for sure the correct way to return the input for a second guess, third guess.......etc Thanks for the great video series. Sure beats Tabor and the other guys from Microsoft. Any suggestions would be greatly welcomed. import random # Gets a random number between 1-10 secret_number = random.randint(1, 10) def main(): validInput = False while not validInput: # Gets the players guess try: user_guess = int(input("Guess a number between 1 and 10 ")) validInput = True except: print("Invalid input. Try again.") #tells player if guessed number is <>== if user_guess == secret_number: print(secret_number, "Is the correct number.") elif user_guess > secret_number: print("You guessed too high.") main() elif user_guess < secret_number: print("You guessed too low.") main() else: print("I don't understand.") main() main()
  2. Hi guys. I just started learning python yesterday. I have no background in programming but I would like to learn python as my first programming language. I need help with this code: if(name == "Lu") or (age == 26): print("Hello Lu") elif(name == "lu" or age != 26): print("Welcome back") else: print("Hello") On my understanding about the or on the if statement, if I did not write "Lu" but write the number 26 it should print "Hello Lu" because from what I've come to understand that if the first variable is false it will then direct to the second variable and if that is true then it will print the code. however when i run my code and write a different name aside from Lu but write the correct number 26 it doesn't print "Hello Lu" rather it prints the "Welcome back" Can anyone help me regarding this?
  3. Hi does anyone know what this error message means or why I am getting it? C:\Users\Dean\Desktop>python helloworld.py Hello World What is your name?Dean Traceback (most recent call last): File "helloworld.py", 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).