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
#1
import random
print('You have rolled: ' + random.randint(1, 6))
what is wrong with this code?

Output:
Traceback (most recent call last): File "C:\Users\brand\OneDrive\Desktop\Python\throwDie.py", line 2, in <module> print('You have rolled: ' + random.randint(1, 6)) TypeError: can only concatenate str (not "int") to str
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,827 Nov-05-2022, 11:33 AM
Last Post: Mavoz
  python gives wrong string length and wrong character thienson30 2 3,110 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