Charlie1995
Charlie1995

Reputation: 29

Error while using print command in python 3.3.2

import random
print((((random.randrange(1,12)//(((random.randrange(1,4)))))))+10)
print((((random.randrange(1,12)//(((random.randrange(1,4)))))))+10)

This is my code so far and it successfully generates two random numbers between the desired integers , now i need it to print in the format of,

Strength = 12
Stamina = 14

I tried like this:

import random
print ' strength = '((((random.randrange(1,12)//(((random.randrange(1,4)))))))+10)
print 'stamina ='((((random.randrange(1,12)//(((random.randrange(1,4)))))))+10)

But this returns an error for a reason unknown to me, I have been stuck on this for hours and I would really appreciate it if someone would help me with this problem, THANKS :)

Upvotes: 0

Views: 206

Answers (2)

Suresh Rao
Suresh Rao

Reputation: 1

import speech_recognition as sr import pyttsx3

listener = sr.Recognizer()
engine = pyttsx3.init()
engine.say('Iam your alexa')
engine.say('what can i do for you')
engine.runAndWait()

try:

with sr.Microphone() as source:
print('listening...')
voice = listener.listen(source)
command = listener.recognize_google(voice)
command = command.lower()
if 'alexa' in command:
 print(command)

except: pass

Upvotes: 0

zhangxaochen
zhangxaochen

Reputation: 34017

print is a function in python3, use () to wrap your contents and , to separate them. And you don't need soooo many extra ()s:

In [40]: print('stamina =', random.randrange(1,12)//random.randrange(1,4)+10)
#stamina = 14

Upvotes: 2

Related Questions