How To Write A Guessing Game Program In Python 3 - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › How To Write A Guessing Game Program In Python 3 (1693 Views)
| How To Write A Guessing Game Program In Python 3 by michelle5683(op): 3:59pm On Sep 23, 2017 |
while true import random comguess= random.randint(0,100) user guess = int(input("Guess a number between 1 - 100: " )if userguess > comguess: print ("Guess lower" ![]() elif userguess < comguess: print ("Guess higher" ![]() else: print ("you are correct! " ![]() break Forgive my indentation, I typed this with an Android device. Enjoy |
| Re: How To Write A Guessing Game Program In Python 3 by michelle5683(op): 4:04pm On Sep 23, 2017 |
Wherever you see a wink it's actually a column and bracket. I don't know how to modify posts. |
| Re: How To Write A Guessing Game Program In Python 3 by 4kings: 4:06pm On Sep 23, 2017 |
Cool, next time put you code within the code tag to avoid indentation problems. Can you work with exception handling or isinstance function to handle incorrect user input? And since you had your 9hours tutorial video, can you provide a gui implementation of this? |
| Re: How To Write A Guessing Game Program In Python 3 by michelle5683(op): 4:08pm On Sep 23, 2017 |
4kings:Perhaps if you explanced the instance I'd know if I've learnt it and perhaps haven't taken not of the name. The video didn't teach me GUI. |
| Re: How To Write A Guessing Game Program In Python 3 by 4kings: 4:17pm On Sep 23, 2017 |
michelle5683:var = input('Enter number: ') isinstance(var, int) This returns true if var is an integer. So it can be tweaked to:
You can learn GUI here: https://pythonprogramming.net/gui-development-tutorials/ |
| Re: How To Write A Guessing Game Program In Python 3 by michelle5683(op): 4:37pm On Sep 23, 2017 |
4kings:Wow thanks a million |
| Re: How To Write A Guessing Game Program In Python 3 by michelle5683(op): 5:20pm On Sep 23, 2017 |
4kings:I'm at the site now and I've commenced learning. What module is best for GUI |
| Re: How To Write A Guessing Game Program In Python 3 by 4kings: 5:31pm On Sep 23, 2017 |
michelle5683:Kivy is the best, since it's cross platform(can be used on android, ios, etc). |
| Re: How To Write A Guessing Game Program In Python 3 by michelle5683(op): 5:32pm On Sep 23, 2017 |
4kings:Thank you a lot |
| Re: How To Write A Guessing Game Program In Python 3 by Exoticstan(m): 8:47pm On Sep 23, 2017 |
4kings:Bro, I believe in you're an expert on Python programming. U need to ask you a private question or two by call perhaps. Contact? |
| Re: How To Write A Guessing Game Program In Python 3 by 4kings: 1:12am On Sep 24, 2017 |
Exoticstan:Mail is preferable. Just send me an email. By the way, i'm no expert. |
| Re: How To Write A Guessing Game Program In Python 3 by crunchyDope(m): 10:10am On Sep 25, 2017 |
michelle5683:put ur codes inside this ==> [pre] #ur codes [/pre ] *note , no space after "pre" |
Python 3: Exercises And Solutions. • Salesforce Rest API Example Using Python 3 • Consume Kibana Rest API Using Python 3 • 2 • 3 • 4
Bulk Sms + PHP And Java Api • Which Forum Software Is Mobile Friendly To Start A Web Forum • 8 Best Android Apps Maker
)