Programming Articles - Page 3219 of 3366

How to print a value for a given key for Python dictionary?

Jayashree
Updated on 26-Feb-2020 11:22:05

7K+ Views

Python dictionary is collection of key value pairs. Value associated with a certain key is returned by get() method.>>> D1={'a':11,'b':22,'c':33} >>> D1.get('b') 22You can also obtain value by using key inside square brackets.>>> D1['c'] 33

How to write the first C++ program?

Akansha Kumari
Updated on 15-Jul-2025 17:30:42

18K+ Views

C++ is a high level programming language that is used to develop applications, work with operating systems, and much more. It is an extension of the C language, which combines both procedural programming (available in C) and object oriented programming. In this article, we will learn step by step the procedure of writing our first C++ program. Prerequist For this, make sure that your computer consists of the following two. C++ Compiler Text Editor or IDE Get a C++ Compiler It is a system that translates the source code (written ... Read More

How to convert float to integer in Python?

Gireesha Devara
Updated on 23-Aug-2023 18:42:17

2K+ Views

In python there are two number data types: integers and floats. In general integers do not have any decimal points and base value is 10 (i.e., Decimal). Whereas floats have decimal points. Python provides some built−in methods to convert floats to integers. In this article we will discuss some of them. Using the int() function The int() function converts the floating point numbers to integers, by removing the decimals and remains only the integer part. Also the int() function does not round the float values like 49.8 up to 50. Example In the example the data after the decimal ... Read More

How do I set up C/C++ on Eclipse in Windows?

Arushi
Updated on 26-Feb-2020 11:21:22

10K+ Views

Step 1 − Install MinGW GCC or Cygwin GCCTo use Eclipse for C/C++ programming, you need a C/C++ compiler. On Windows, you could install either MinGW GCC or Cygwin GCC. Choose MinGW if you are not sure, because MinGW is lighter and easier to install, but has fewer features.MinGW GCCTo install MinGW, go to the MinGW homepage, www.mingw.org, and follow the link to the MinGW download page. Download the latest version of the MinGW installation program which should be named MinGW .exe.While installing MinGW, at a minimum, you must install gcc-core, gcc-g++, binutils, and the MinGW runtime, but you may ... Read More

How to convert an integer to a character in Python?

Gireesha Devara
Updated on 23-Aug-2023 18:36:02

37K+ Views

To convert an integer to a character in Python, we can use the chr() method. The chr() is a Python built−in method that returns a character from an integer. The method takes an integer value and returns a unicode character corresponding to that integer. Syntax char(number) Parameter The method takes a single integer between the range of 0 to 1, 114, 111. Return Value A unicode character of the corresponding integer argument. And it will raies a ValueError if we pass an out of range value (i, e. range(0x110000)). Also it will raise TypeError − for a non−integer argument. ... Read More

Why do we use a volatile qualifier in C++?

Ankitha Reddy
Updated on 30-Jul-2019 22:30:21

518 Views

volatile means two things − The value of the variable may change without any code of yours changing it. Therefore whenever the compiler reads the value of the variable, it may not assume that it is the same as the last time it was read, or that it is the same as the last value stored, but it must be read again. The act of storing a value to a volatile variable is a "side effect" which can be observed from the outside, so the compiler is not allowed to remove the act of storing a value; for example, ... Read More

How to print out the first character of each list in Python?

Shriansh Kumar
Updated on 12-Jul-2025 23:57:50

5K+ Views

A Python list is a built-in, mutable datatype that stores multiple items or elements, separated by commas, within square brackets [ ]. The index of a list in Python starts from 0 up to length-1. We can retrieve/access elements at a particular index as follows - list_name[index] The given task is to write a Python program that prints the first character of each element in a list. But, before that, let's see some example scenarios: Scenario 1 For example, if our list contains string values, the output should be the first character of each string. Input: list = ... Read More

What is the type specifier for boolean in C++?

Govinda Sai
Updated on 26-Feb-2020 11:15:59

259 Views

The type specifier for boolean in c++ is bool. You can use it as −bool myBoolean = true;

What are type specifiers in C++?

Akansha Kumari
Updated on 23-Jul-2025 15:46:50

3K+ Views

In a statically typed language such as C++, type specifiers are keywords that are used to define the type of data that given variables will hold. There are two types of type specifiers: built-in and user-defined type specifiers. Built-in Type SpecifiersThe built-in type specifiers are the basic and predefined data types provided by C++, such as int, float, char, signed, unsigned, short, long, etc. int myNumber = 42; In this given statement, the "int" is a type specifier, which states that the variable "myNumber" can only store integer values or numeric data types. There exist a lot of built-in type specifiers in C++ ... Read More

What are type qualifiers in C++?

Akansha Kumari
Updated on 28-May-2025 19:04:29

2K+ Views

A type qualifier is a keyword in C++ that is applied to a variable, function, pointer, or parameter to add an extra feature or quality to it. For example, const int is a qualified type representing a constant integer, while int is an unqualified type, which is simply just an integer. Type qualifiers are a way of expressing additional information about a value through the type system, which ensures correctness in the use of the data. 1. The const Qualifier This is used to define a variable (or object) as constant, which means its value cannot be changed or modified ... Read More

Advertisements