Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,195,067 members, 7,956,982 topics. Date: Tuesday, 24 September 2024 at 01:20 AM |
Nairaland Forum / Science/Technology / Programming / How To Write A Guessing Game Program In Python 3 (1463 Views)
Python 3: Exercises And Solutions. / Salesforce Rest API Example Using Python 3 / Consume Kibana Rest API Using Python 3 (2) (3) (4)
How To Write A Guessing Game Program In Python 3 by michelle5683(f): 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(f): 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(f): 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(f): 4:37pm On Sep 23, 2017 |
4kings: Wow thanks a million 1 Like |
Re: How To Write A Guessing Game Program In Python 3 by michelle5683(f): 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(f): 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" |
(1) (Reply)
In Need Of 3 Web Developer To Work With On A New Project / Android Development - Multiple Screen Support / I Want To Learn Programming And Coding! Were And How Do I Start?
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 16 |