Python Forum
Can't get defined random integer to print properly?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't get defined random integer to print properly?
#1
https://imgur.com/a/TAarvQQ

^I've attached the image above, program when it runs is on the left. Any help would be appreciated Smile
Reply
#2
import random

print("Welcome!")


def diceroll():
    return random.randint(1, 6)


print(diceroll())
Now this works. You did not return anything.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to print the output of a defined function bshoushtarian 4 1,323 Sep-08-2022, 01:44 PM
Last Post: deanhystad
  python library not defined in user defined function johnEmScott 2 3,887 May-30-2020, 04:14 AM
Last Post: DT2000
  Call to a print in a defined function leodavinci1990 1 1,915 Nov-20-2019, 01:45 AM
Last Post: ichabod801
  Beginner at Python. Trying to count certain integer from random string of code kiaspelleditwrong 3 2,433 Oct-14-2019, 10:40 AM
Last Post: perfringo
  Print random musik to wav file Pereskia 2 2,684 Mar-27-2019, 11:53 AM
Last Post: Pereskia
  How to get a random item from a list, print it and delete it? giorgosmarga 3 2,600 Feb-22-2019, 05:33 PM
Last Post: Yoriz
  20 x 20 Integer array with random numbers harryk 3 3,346 Jul-28-2018, 03:38 PM
Last Post: harryk
  How to print a global dictionary class properly 3dimensions 2 3,237 Apr-18-2018, 05:45 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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