Followers

Wednesday, 16 November 2022

Program to print muliple copies of string

In python we use "*" operator to create multiple copies of string. For example if we want a string value to be displayed  more than 1 time, we can use 

Syntax: string_var * n  where n = number of times to be printed

Reference of the code run in JupyterLab


Program to Concatenate two strings in Python

 String is one of the important data type in Python. String is collection of characters which are enclosed in double quotes. Here we are discussing concatenating 2 strings as below:

1. Assign first string vale to variable1

2. Assign second string value to variable 2

3. Add the two string variables using " +" operator which adds second string to end of first string1

Reference of the code run in JupyterLab 




Program to find the Numeric datatypes in Python

 In Python Programming, there are several datatypes supported. Numeric data types in python are  used to hold numeric values. There are 3 types of numeric datatypes allowed in python programming.

1.Integer

2.Float 

3.Complex.

type()  : is used to find the datatype of variable.


Reference of the code run in JupyterLab