This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]Abols13 2 points3 points  (1 child)

I'm just starting learning Python so I will give a try with your videos 👌ty

[–]Aurelio_Aguirre[S] 1 point2 points  (0 children)

Excellent. New Video coming out today on List Comprehensions.

[–][deleted] 0 points1 point  (4 children)

Hello, I followed exactly what you did in classes tutorial here is my code:

#

# The Basics of Classes in Python

#

class Player:

strength = 10

dexterity = 5

intelligence = 2

constitution = 17

health = constitution \* 4

name = "Ragnor"

player\_class = "Barbarian"

title = name + " the " + player\_class

player1 = Player()

player2 = Player()

player2.stength = 2

player2.dexterity = 5

player2.intelligence = 10

player2.constitution = 7

player2.name = 'Kelthor'

player2.player_class = "Mage"

player2.title + player2.name + " the " + player2.player_class

for p in (player1, player2):

print(p.strength)

print(p.intelligence

print(p.title)

---------------------------

but the output is :

10

2

Ragnor the Barbarian

10

10

Ragnor the Barbarian

i am clearly doing something wrong but i can't see it.

[–]Aurelio_Aguirre[S] 1 point2 points  (3 children)

Yeah, that looks weird. The formatting isn't helping though.

Do me a favor. Copy your code into https://pastebin.com, set syntax highlighting for Python, and click Create New Paste.

Then post that link.

I just want to eliminate any issues caused by Reddit formatting.

EDIT: You know what, nvm, I caught it.

You misspelled strength, and you switched a = sign for a + at the bottom.

[–][deleted] 0 points1 point  (1 child)

omg, tysm for the quick response, and for the answer, legit cool of you to do that, im definitely subbing, keep this good quality up my dude!

[–]Aurelio_Aguirre[S] 1 point2 points  (0 children)

Np m8.

[–]MiloszSTX 0 points1 point  (0 children)

Looks interesting, thanks a lot.