coderz.py

Keep Coding Keep Cheering!

Python – if, elif, else Conditions

Python’s conditional statements carry out various calculations or operations according to whether a particular Boolean constraint evaluates to true or false. In Python, if statements deal with conditional statements. The conditional statements that Python offers are listed below. if if..else Nested if if-elif statements. if Statement: To make decisions, use the if statement in Python. […]

December 3, 2022 | python | No comments

Relational & Logical Operators in Python

In Python, operators are specialized symbols that perform different computations. To create an expression, we combine operators and operands. Expressions are merely values’ representations. The fundamental building blocks of a program that define its functionality are relation and logic. Relational operator: Value comparisons are done using relational operators, also known as comparison operators. It responds […]

December 2, 2022 | python | No comments

Python Tuple

What is Python Tuple? A Python Tuple is a group of items that are separated by commas. The indexing, nested objects, and repetition of a tuple are somewhat similar to those of a list, but unlike a list, a tuple is immutable. Example: Output: Empty Tuple: Output: Indexing in Tuples: The index operator [] can […]

December 1, 2022 | python | No comments

Python Dictionary Methods

Let’s look at some crucial features that are very useful when experimenting with dictionaries in Python. Python Dictionary Methods: Functions Description clear() Eliminates everything from the dictionary copy() Returns a shallow copy of the dictionary fromkeys() A dictionary is formed using the provided sequence. get() Returns the value for the given key items() Return the […]

November 30, 2022 | python | No comments

Python Dictionary

Python Dictionary is used to store the data in a key-value pair format. Python’s dictionary data type can mimic real-world data arrangements where a particular value exists for a particular key. The mutable data structure is what it is. The element Keys and values is used to define the dictionary. Keys must consist of just […]

November 29, 2022 | python | No comments

Remove elements from a Python List

There are three methods to remove elements from a list: Making use of the remove() method Using the pop() method of the list object Using the del operator remove() method: The list includes a built-in method for Python called removes (). Removing the first element that matches the given criteria from the list is helpful. […]

November 27, 2022 | python | No comments

Find the Reverse of a Number

When a number is reversed, the digits are rearranged in reverse order, starting with the last digit, then the second-to-last digit, and so on, with the first digit appearing last. Program Code: Output: Note: also read about Armstrong Number in C++ Follow Me Please follow me to read my latest post on programming and technology if you […]

November 27, 2022 | C++ | No comments

Iterate over a list in Python

In Python, there are several different ways to iterate through a list. Let’s examine every method for iterating over a list in Python and compare their performance. Using For loop: The “for” loop in Python is a way to run a repetitive block of code traversing over a sequence of any kind. For instance, Output: […]

November 26, 2022 | python | No comments

Python Lists

As we have already seen in Data Types in Python that Python Lists are just like dynamically sized arrays, declared in other languages (vector in C++ and ArrayList in Java). Let us take a look at them in a more detailed way. Characteristics of Lists: The list has the following characteristics: The lists are ordered. The list’s […]

November 25, 2022 | python | No comments

String Functions – II

Table of Python String Methods. Function Name  Description capitalize() The string’s first character is changed to an uppercase (capital) letter. casefold() Implements caseless string matching center() Add the requested character to the string as padding. count() Returns the number of occurrences of a substring in the string. encode() Encodes strings with the specified encoding scheme […]

November 24, 2022 | python | No comments

Advertisement