menu
  • home
  • book
  • school
  • apps
  • account_circle
  • comment
  • Pywe Guest Guest Login/Signup
  • homeHome
  • bookCourses
  • schoolCompete
  • appsApps
  • account_circleLogin/Signup
  • commentForum

Welcome to the Forum

Click on a comment to view replies
  • comment

    Hello guys, post your comments, views, and questions here for answers or discussions. Remember, the best comments are those that help build others, those from which everyone or at least someone can learn something new. Happy Pythoning!



    Jan. 20, 2019 at 12:36 p.m. | reply | 0 reply



Please Login to join the discussion

Python Trick

Sample. Choose a selection of items from a list randomly. It will not return duplicates unless of course there are duplicates in the list. It's an easy way of selecting multiple items from a list randomly. (Click in the code editor below to view code)


from random import sample


names = ["Python", "Java", "Html", "C++", "C#"]
chosenPrograms = sample(names, 3)
print(chosenPrograms)

Close
About Us

We teach Python from scratch.

PywE
  • Facebook
  • GitHub
Tutorials
menu
  • arrow_upward
  • camera

© 2017 - 2019 Copyright PywE