Python Forum
What is wrong with the random
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is wrong with the random
#4
All versions before 3.6 supports only the format method, the % operator and some other methods.
Also Python 2.7 supports the format method.
If you want to use format strings, you apply what you've learned about the format method.
In addition you can put f-strings in you code, to guarantee that's not executed below Python 3.6.

The benefit with formatting is, that you don not have to convert the datatypes by yourself.
If you just concatenate strings with the + operator, all objects must be strings.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
What is wrong with the random - by bdog_123 - Oct-22-2019, 12:19 AM
RE: What is wrong with the random - by ichabod801 - Oct-22-2019, 01:18 AM
RE: What is wrong with the random - by bdog_123 - Oct-22-2019, 01:32 AM
RE: What is wrong with the random - by DeaD_EyE - Oct-22-2019, 06:06 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Am I wrong or is Udemy wrong? String Slicing! Mavoz 3 2,577 Nov-05-2022, 11:33 AM
Last Post: Mavoz
  python gives wrong string length and wrong character thienson30 2 3,025 Oct-15-2019, 08:54 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020