473,506 Members | 16,954 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AttributeError: 'module' object has no attribute 'randit'

3 New Member
Expand|Select|Wrap|Line Numbers
  1.  
  2. import random
  3.  
  4. print('Welcome to Guess the Number')
  5. print('Try to guess the number in as few tries as possible')
  6.  
  7. the_number= random.randit(1, 100)
  8.  
  9. guess=int(input('Take a guess!  '))
  10. tries=1
  11.  
  12.  
  13. while guess != nbum:
  14.           if guess>the_number:
  15.               print('Lower... ')
  16.  
  17.  
  18. else:
  19.           print('Higher... ')
  20.  
  21.  
  22. guess= int(input('Take a guess!  '))
  23. tries+=1
  24.  
  25. print('Well done! The number was', the_number)
  26. print('and it only took u=you', tries, 'tries!')
  27.  
  28. input('n/nPress the enter key to exit')
  29.  
  30.  
Sep 22 '15 #1
2 2998
Rabbit
12,516 Recognized Expert Moderator MVP
The error message is correct, there is nothing named randit in the random module.

You're probably looking for randint.
Sep 22 '15 #2
am5243
3 New Member
Thanks! I tried that and it worked straight away :)
Sep 23 '15 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
9513
by: dont bother | last post by:
Hey, I am trying to run the following example from diveintopython import urllib sock = urllib.urlopen("http://diveintopython.org/") htmlSource = sock.read() sock.close() print htmlSource
4
7639
by: adrian | last post by:
I get those errors when I run: /usr/local/bin/SquidClamAV_Redirector.py -c /etc/squid/SquidClamAV_Redirector.conf ################## Traceback (most recent call last): File...
2
3393
by: rsd | last post by:
Hi, I'm trying get Samsung YH-920 mp3 player to work with Debian GNU/Linux. To do that I need to run http://www.paul.sladen.org/toys/samsung-yh-925/yh-925-db-0.1.py script, the idea behind the...
0
1629
by: kepioo | last post by:
I am running a script (summary.py) which is calling the method logException in another module ( pytool). Yesterday, ard 18:50, all of a sudden summary.py was throwing the exception : ...
0
428
by: rkmr.em | last post by:
Hi I built and installed python 2.5 from source and when I do this: opener = urllib2.build_opener(SmartRedirectHandler(), DefaultErrorHandler(), urllib2.HTTPSHandler()) I get this error....
4
23409
by: black_13 | last post by:
what does this error mean? i am trying to use mark hammonds win32 package. Traceback (most recent call last): File "aui2.py", line 11, in <module> import win32com.client File...
4
6104
by: Nikhil | last post by:
I have recently written a small module. When I import the module, I always get the error only when I do -- Traceback (most recent call last): File "<stdin>", line 1, in <module>
1
6346
by: =?iso-8859-1?q?KLEIN_St=E9phane?= | last post by:
Hi, I'm on Ubuntu 8.04.1 I've installed lxml with easy_install lxml command. Now, when I load etree I've this error : $ python Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42)
0
1925
by: =?iso-8859-1?q?KLEIN_St=E9phane?= | last post by:
Le Mon, 25 Aug 2008 13:50:50 +0000, KLEIN Stéphane a écrit : I've this bug only with lxml2, lxml 1.3.3 work very well. Regards, Stephane
1
3946
by: JohannesTU | last post by:
Hello everyone, I'm new to linux/suse, but I was given the task to install the print accounting software PyKota. Before that I never even touched a linux system, so I don't have any basic...
0
7307
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7021
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7478
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4701
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1532
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
409
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.