Skip to content

lesson 13 f - strings #3

@langerking

Description

@langerking

Really enjoying your course. So much packed into every lesson, really well done!

Just wanted to comment that when you change the concatenated strings in rps5.py to f-strings I think it should be noted that you can further simplify:
f string allows multiple datatypes so several castings to different variable types can be omitted:

ln 26 player = int(playerchoice)
and computer = int(computerchoice)

the print statements on ln 33, 34 can be shortened:

from: print("\nYou chose {str(RPS(player)).replace('RPS.', '').title()}")
to: print(f"\nYou chose {playerchoice.replace('RPS.', '').title()}")

also print statements ln 62, 63 & 64 do not need the str constructor:
print("\nGame count: {str(game_count)) >> print(f"\nGame count: {game_count}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions