I'm back. Still chugging away on my Network Admin degree and I have to take this Python Programming class. Well, It takes a special, very smart person to be a programmer, which I could never be.
Anyhoo, I've got an assignment here that I'm stuck on. My flowchart is logical, I know what to do, but my code is off.
I'm supposed to create a program that presents a person running it with a random fortune, however, I'm getting a syntax error around my first if/then statement.
Here's what I got
import random
n = random.ranrange(5) + 1
if n = 1:
print Be prepared
if n = 2:
print Never give advice unless asked
if n = 3:
print Behind an able man are always other able men
if n = 4:
print Complain tot he one who can help you
if n = 5:
print All sins cast long shadows
raw_input("\n\nPress the enter key to exit.")
Please let me know what I'm doing wrong and how to correct it.
Question
briangw
I'm back. Still chugging away on my Network Admin degree and I have to take this Python Programming class. Well, It takes a special, very smart person to be a programmer, which I could never be.
Anyhoo, I've got an assignment here that I'm stuck on. My flowchart is logical, I know what to do, but my code is off.
I'm supposed to create a program that presents a person running it with a random fortune, however, I'm getting a syntax error around my first if/then statement.
Here's what I got
import random
n = random.ranrange(5) + 1
if n = 1:
print Be prepared
if n = 2:
print Never give advice unless asked
if n = 3:
print Behind an able man are always other able men
if n = 4:
print Complain tot he one who can help you
if n = 5:
print All sins cast long shadows
raw_input("\n\nPress the enter key to exit.")
Please let me know what I'm doing wrong and how to correct it.
Link to comment
Share on other sites
6 answers to this question
Recommended Posts