Python Forum
not able to complete a project
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
not able to complete a project
#3
I'm not able to think of anything other than this:

num=int(input ('User\'s Input:\n'))
import random
num2=random.randint(1,50)
while num2 != num:
    if num2 > num:
        print ('Lower')
    if num2 < num:
        print ('Higher')
    else:
        print ('Comp guessed it right')
        break

input ('Press enter to exit')
I created an infinite loop.
I'm not able to think how am gonna make comp keep guessing until the number matches User's input

Thank you...
Reply


Messages In This Thread
not able to complete a project - by olmin - Jun-29-2018, 04:58 AM
RE: not able to complete a project - by j.crater - Jun-29-2018, 06:52 AM
RE: not able to complete a project - by olmin - Jun-29-2018, 12:13 PM
RE: not able to complete a project - by ichabod801 - Jun-29-2018, 03:00 PM
RE: not able to complete a project - by volcano63 - Jun-29-2018, 07:11 PM
RE: not able to complete a project - by olmin - Jun-30-2018, 09:58 AM
RE: not able to complete a project - by j.crater - Jun-30-2018, 10:09 AM
RE: not able to complete a project - by volcano63 - Jun-30-2018, 10:17 AM
RE: not able to complete a project - by olmin - Jun-30-2018, 02:21 PM
RE: not able to complete a project - by ichabod801 - Jun-30-2018, 02:36 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020