Skip to main content

Posts

Showing posts with the label start python

Rolling Dice Simulator (PCTS)

Python Codes The Series - 2 Photo by Brett Jordan on Unsplash Playing Ludo or Snakes & Ladders and just lost 😰 your dice 🎲; well, no need to worry till I am with you 🙋🏻‍♂️. Just use Python. Many of you might think 🤔 that I am crazy but believe me I am not crazy 😧. We will learn today to use Python for making a rolling dice simulator program.  Here, we are using random module to use the various random functions to make the probability of each outcomes equal. Copy the following code: #importing random module... import random ''' Taking a number between 1 and 10000 using randrange function ''' start = 1 end = 10000 num = random.randrange(start,end+1) #Now choosing the first digit of num from left... num_2 = str(num)[0] num_2 = int(num_2) ''' Finally, choosing the number for the die ''' if num_2 < 6: roll = random.randrange(1,num_2+1) elif num_2 == 6: roll = num_2 else: num_2 = num_2 - 3 roll = ran...

Opening Python

How to get started with the default CPython distribution Step 1: Download and install the python(3.x) from the provided link:                      https://www.python.org/downloads/ Step 2: Click on windows logo to open the start menu. Step 3: Now from there in Python(3.x) folder, click on Python idle. You can see a window of Python(3.x) idle pops up. Note: There are two modes of working in Python(3.x) idle: 1. Interactive mode: Here, you don’t have to save any python file unnecessarily in order to run it. The user can type the code directly in the idle and the output of the code would be given instantly. 2. Script mode: In script mode, the whole program is written using a number of codes and then saved in an appropriate file which is then run. Here, at last the program generally gets converted into an ‘.exe’ file. Step I: Move your cursor to the top left corner of the idle box, there click on the ...

Our view towards Python (as a programming language)

  Python - The language of the future Introduction When we hear the term programming language, we usually talk about high-level programming language which are those programming language having a lucid (or easy-to-read) syntax and are later converted to low-level language (binary) , which is understandable by the computer.  Programming language has always been an area of interest over the passing years since the very early days of ' Fortran ' (created by John Backus at  IBM ). To this day, dozens of programming language has been created by different 'Computer Scientists' around the world. What is Python? What is Python? Many of you will describe a large scary snake 🐍, which isn't actually wrong 😅. But here we are talking about a programming language. Similarly, Python is also a high-level and interepreted programming language created by  Guido van Rossum in the late 1980s . It was first released in 1991 as a successor to ABC Programming language . It known fo...