Thursday, 6 August 2020

Simple Snake Game Code for Advanced Dev's
Checking if two strings are Anagram

Problem:

 

Objective: To Check whether two strings are Anagrams or Not.

What are Anagram strings?

The strings which constitutes of the same letters but arranged in different order are called as Anagrams.

Example: Silent and Listen are Anagrams since both contain the same letters {I,E,L,S,T}.

Input Format:

First two lines takes the two strings to check for.

Gets is used although it is not advised to use gets() since it can cause Buffer Overflow. But since it is a simple program we have neglected that.

We have used vector for this program.

Vector are nothing but kind of dynamic arrays.

We daclare a vector as

“vector<string> s11,s22; ”

Here s11 and s22 are vector strings

Sample Code:


Finding A big Factorial in c++

Problem:Objective: To find the Factorial of Numbers whose factorial is of the order 10^7.Input:

Output: The next t lines after input gives the ouput.

Code

Output
Explaination:
We are storing the factorial in parts in array indices. Instead of finding the factorial of given number we are finding the factorials of all numbers upto 100001 in their respective array indices and just print the desired facts
 By taking mod with our self defined value of 10^7 we are in a way compressing the number at each level so that are data types can hold that value.

a[i] = ((i%mod)*(a[i-1]%mod))%mod;
The above line of code is very important to understand the code.
This is the line in which through which we are compressing the number to our data type limits (long long) 
 













Monday, 3 August 2020

Printing fibbonaci series without recursion in C++


Problem

Objective: To print n Fibonacci series terms.

Code:






















Sample Output:










Compiler Used:
DEV-C++

For feedback or query:
Printing a right aligned staircase in C++

Problem

To print a right aligned staircase as follows:

         #
     ##
   ###
 ####
#####

Input: A integer N denoting number of rows

Code:
Output:




Sunday, 2 August 2020

How to download Pycharm for Coding in python!!

Install PyCharm

PyCharm is a cross-platform IDE that provides consistent experience on the Windows, macOS, and Linux operating systems.

PyCharm is available in three editions: ProfessionalCommunity, and Edu. The Community and Edu editions are open-source projects and they are free, but they have less features. 

PyCharm Edu provides courses and helps you learn programming with Python. The Professional edition is commercial, and provides an outstanding set of tools and features.

System requirements

RequirementMinimumRecommended
RAM4 GB of free RAM8 GB of total system RAM
Disk space2.5 GB and another 1 GB for cachesSSD drive with at least 5 GB of free space
Monitor resolution1024x7681920×1080
Operating system

Officially released 64-bit versions of the following:

  • Microsoft Windows 8 or later

  • macOS 10.13 or later

  • Any Linux distribution that supports Gnome, KDE , or Unity DE

Pre-release versions are not supported.

Latest 64-bit version of Windows, macOS, or Linux (for example, Debian, Ubuntu, or RHEL)

You do not need to install Java to run PyCharm, because JetBrains Runtime is bundled with the IDE (based on JRE 11).

  • Python 2: version 2.7

  • Python 3: from the version 3.5 up to the version 3.9

 

 

Install the Toolbox App

  1. Download the installer .exe from the Toolbox App web page.

  2. Run the installer and follow the wizard steps.

After you run the Toolbox App, click its icon in the notification area and select which product and version you want to install.

The Toolbox App

Log in to your JetBrains Account from the Toolbox App and it will automatically activate the available licenses for any IDE that you install.

Standalone installation

Install PyCharm manually to manage the location of every instance and all the configuration files. For example, if you have a policy that requires specific install locations.

  1. Download the installer.exe.

    To verify the integrity of the installer, use the SHA checksum linked from the Download page.

  2. Run the installer and follow the wizard steps.

    Mind the following options in the installation wizard

    • 64-bit launcher: Adds a launching icon to the Desktop.

    • Open Folder as Project: Adds an option to the folder context menu that will allow opening the selected directory as a PyCharm project.

    • .py: Establishes an association with Python files to open them in PyCharm.

    • Add launchers dir to the PATH: Allows running this PyCharm instance from the Console without specifying the path to it.

When you run PyCharm for the first time, some steps are required to complete the installation, customize your instance, and start working with the IDE.

For more information, see Run PyCharm for the first time.

Silent installation on Window

 Silent installation is performed without any user interface. It can be used by network administrators to install PyCharm on a number of machines and avoid interrupting other users.

To perform silent install, run the installer with the following switches:

  • /S: Enable silent install

  • /CONFIG: Specify the path to the silent configuration file

  • /D: Specify the path to the installation directory

    This parameter must be the last in the command line and it should not contain any quotes even if the path contains blank spaces.

For example:

pycharm-professional.exe /S /CONFIG=d:\temp\silent.config /D=d:\IDE\PyCharm
Copied!
or
pycharm.exe /S /CONFIG=d:\temp\edu_silent.config /D=d:\IDE\PyCharm Edu
Copied!

To check for issues during the installation process, add the /LOG switch with the log file path and name between the /S and /D parameters. The installer will generate the specified log file. For example:

pycharm-professional.exe /S /CONFIG=d:\temp\silent.config /LOG=d:\JetBrains\PyCharm\install.log /D=d:\IDE\PyCharm
Copied!

or

pycharm.exe /S /CONFIG=d:\temp\edu_silent.config /LOG=d:\JetBrains\PyCharmEdu\install.log /D=d:\IDE\PyCharm Edu
Copied!

Silent configuration file 

You can download the silent configuration files for PyCharm at https://download.jetbrains.com/python/silent.config and https://download.jetbrains.com/python/edu_silent.config

The silent configuration file defines the options for installing PyCharm. With the default options, silent installation is performed only for the current user: mode=user. If you want to install PyCharm for all users, change the value of the installation mode option to mode=admin and run the installer as an administrator.

The default silent configuration file is unique for each JetBrains product. You can modify it to enable or disable various installation options as necessary.

Saturday, 1 August 2020

Python program to find number of numbers with odd number of factors.











Objective: 

To find the count of numbers in a given range having odd number of factors.

#Solution Code:

#assignment 23
def count_factors(Number):
    factor_count=
0
   
for i in range(1,int(Number+1)):
       
if Number % i == 0:
            factor_count +=
1
   
return factor_count
"""Function Ended"""
"""Main program begins here"""
a = int(input("Enter the lower range of number: "))
b =
int(input("Enter the Upper range of number(this will be included): "))
print("**************************************************************************")
number_elements =
0
for number in range(a,b+1):
    Number_Factor = count_factors(number)
   
if Number_Factor % 2 == 1:
        number_elements +=
1
print("No. of numbers having odd number of factors are: ",number_elements)

#Ouptut






#Explaination:

Step 1:

Firstly we define a function named a count_factors() which takes a int variable as its parameter. Here Number is passed as an formal parameter.

Now we initialize a int variable factor_count which stores a value 0.

Now we run a for loop and run it from i = 1 to i = Number. (note: we pass i =Number+1 so that i = Number is included).

#FOR LOOP BODY

In for loop body we check a condition whether Number % i == 0 (if i is a factor of Number). If this is true then we increase the value of factor_count by 1.

At the end of for loop we return factor_count.

Step 2:

#Drivers Code

We input a lower range value and store it in variable a and an upper range value and store it in variable b.

We then initialize a variable number_elements = 0.

Now we again run a for loop from number = a to number = b+1 (b+1 so that number = b is included).

In #For body we pass number in count_factors() as parameter and store the value returned in a variable Number_factor.

Now we check if Number_factor is odd ( if Number_factor % 2 == 1 : )

If true then we increment value of number_elements by 1 else we continue the loop.

Step 3: End

We print the value of number_elements obtained after completion of for loop.