Hey everyone, I am very new to all of this programing stuff, but I love it all the same. I am currently taking a intro python class, but due to illness I wasn't able to attend class for a week and a half. I came back to find out we have two assignments do tooday and I am not sure how to complete them, so any hints or code would be greatly appricated.
#1 create a word list and have it print out in a random order.
#2 create a RPG using a points value system for your characters stats.
the book I have is very clear on certain matters yet very unclear on these inparticular, thankyou for any help that you can give!
6 1796
Sorry for the bad post. I am running on both MAC OSX and Windows Xp.
I tried I can create the list and have it print: -
-
import random
-
index="billy, george, joe, bob, milly, molly, text, tj, tod, jess, fran"
-
-
print index
-
-
raw_input("\nPress Enter to Exit")
-
-
I tried a random.randrange such as -
-
import random
-
index="billy, george, joe, bob, milly, molly, text, tj, tod, jess, fran"
-
index=random.randrange(10)
-
print index
-
-
raw_input("\nPress Enter to Exit")
-
-
on it but it kept printing out numbers instead of the words that I wanted. Like this:
{output from code}
>>>
4
Press Enter to Exit
{/output from code}
As to the RPG Program, I am without words. I looked at other texts and was very impressed with the complicated coding, although I didn't understand it very well. I am not asking for anyone to create the code for me, just to give me a int or push in the right direction as to where i can learn at a step by step pace.
Hey everyone, I am very new to all of this programing stuff, but I love it all the same. I am currently taking a intro python class, but due to illness I wasn't able to attend class for a week and a half. I came back to find out we have two assignments do tooday and I am not sure how to complete them, so any hints or code would be greatly appricated.
#1 create a word list and have it print out in a random order.
#2 create a RPG using a points value system for your characters stats.
the book I have is very clear on certain matters yet very unclear on these inparticular, thankyou for any help that you can give!
bartonc 6,596
Recognized Expert Expert
This is a great post!
Sorry for the bad post. I am running on both MAC OSX and Windows Xp.
I tried I can create the list and have it print: -
-
import random
-
index="billy, george, joe, bob, milly, molly, text, tj, tod, jess, fran"
-
-
print index
-
-
raw_input("\nPress Enter to Exit")
-
-
I tried a random.randrange such as -
-
import random
-
index="billy, george, joe, bob, milly, molly, text, tj, tod, jess, fran"
-
index=random.randrange(10)
-
print index
-
-
raw_input("\nPress Enter to Exit")
-
-
on it but it kept printing out numbers instead of the words that I wanted. Like this:
{output from code}
>>>
4
Press Enter to Exit
{/output from code}
As to the RPG Program, I am without words. I looked at other texts and was very impressed with the complicated coding, although I didn't understand it very well. I am not asking for anyone to create the code for me, just to give me a int or push in the right direction as to where i can learn at a step by step pace.
This is a general idea of how I'd arange this. Please forgive errors, I'm doing this on the fly... -
import random
-
index="billy, george, joe, bob, milly, molly, text, tj, tod, jess, fran"
-
size = len(index)
-
usedindexList = [] # an empty list
-
while len(usedindexList) < size:
-
i = random.randomint(size)
-
if i not in usedindexList:
-
usedindexList.append(i)
-
print index[i]
-
-
raw_input("\nPress Enter to Exit")
-
that is great, thankyou so very much! I am hopefully going to be able to post what I have for the RPG program, and maybe you could give some insight on that as well. Once again thanks, it was a great help!
This is a great post!
This is a general idea of how I'd arange this. Please forgive errors, I'm doing this on the fly... -
import random
-
index="billy, george, joe, bob, milly, molly, text, tj, tod, jess, fran"
-
size = len(index)
-
usedindexList = [] # an empty list
-
while len(usedindexList) < size:
-
i = random.randomint(size)
-
if i not in usedindexList:
-
usedindexList.append(i)
-
print index[i]
-
-
raw_input("\nPress Enter to Exit")
-
bartonc 6,596
Recognized Expert Expert
that is great, thankyou so very much! I am hopefully going to be able to post what I have for the RPG program, and maybe you could give some insight on that as well. Once again thanks, it was a great help!
You are very welcome. So what is RPG, anyway.
Role Playing Game, I didn't have a chance to set it up last night though, but I am sure I can get a grace day. The project is: I have to create a program that give the user a character and yet allow the user to spend 30 point on 4 different stats, (health, stength, armor, defense). The user will be able to add to and take away from the stats he or she has creat until the end when they select finished. I may not be complicated to some people on here, but for a new noobie like me, hahaha sounds near impossible. But I am giving it a try!
bartonc 6,596
Recognized Expert Expert
Role Playing Game, I didn't have a chance to set it up last night though, but I am sure I can get a grace day. The project is: I have to create a program that give the user a character and yet allow the user to spend 30 point on 4 different stats, (health, stength, armor, defense). The user will be able to add to and take away from the stats he or she has creat until the end when they select finished. I may not be complicated to some people on here, but for a new noobie like me, hahaha sounds near impossible. But I am giving it a try!
That's great! I'm going to go ahead and call you fist question "solved" and close this thread. You can go ahead and start a new thread for "role playing game", OK.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Art |
last post by:
NEWBIE ALERT!
Esteemed List Participants and Lurkers:
(System: P-II 350, 192 meg, Win98 SE, Python 2.2.3,
wxPythonWIN32-2.4.1.2-Py22.exe)
I'm having a lot of fun getting started with Python...
|
by: kbass |
last post by:
In different articles that I have read, persons have constantly eluded to
the productivity gains of Python. One person stated that Python's
productivity gain was 5 to 10 times over Java in some in...
|
by: Maurice LING |
last post by:
This may be a dumb thing to ask, but besides the penalty for dynamic
typing, is there any other real reasons that Python is slower than Java?
maurice
|
by: Todd_Calhoun |
last post by:
I'm trying to learn Python (and programming), and I'm wondering if there are
any places where I can find small, simple programs to study.
Thanks.
|
by: Alf P. Steinbach |
last post by:
The seventh part of my attempted Correct C++ tutorial is now available,
although for now only in Word format (use free Open Office if no Word), and
also, it's not yet been reviewed at all -- ...
| |
by: Mark Dufour |
last post by:
After nine months of hard work, I am proud to introduce my baby to the
world: an experimental Python-to-C++ compiler. It can convert many
Python programs into optimized C++ code, without any user...
|
by: enquiring mind |
last post by:
I read the posting by Rehceb Rotkiv and response but don't know if it
relates to my problem in any way.
I only want to write German to the screen/console for little German
programs/exercises in...
|
by: Linus Cohen |
last post by:
Hi all,
I'm a newbie to python and programming in general, so I wanted a
simple project to start off. What I'm trying to do here is write a
python command-line ping program, much like the Unix and...
|
by: SMALLp |
last post by:
Hy! I have error something like this
TypeError: unbound method insert() must be called with insertData
instance as first argument (got str instance instead)
CODE:
File1.py...
|
by: anonymous |
last post by:
1 Objective to write little programs to help me learn German. See code
after numbered comments. //Thanks in advance for any direction or
suggestions.
tk
2 Want keyboard answer input, for...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
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...
|
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...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
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 ...
|
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...
| |