Posts

Showing posts from March, 2022

Python Syntax, Comments, Variables, Indentation

Execute Python Syntax As we learned in the past page, Python grammar can be executed by composing straightforwardly in the Command Line: >>> print("Hello, World!") Hello, World!  Or on the other hand by making a python record on the server, utilizing the .py document augmentation, and running it in the Command Line: C:\Users\ Your Name >python myfile.py  Python Indentation Space alludes to the spaces toward the start of a code line. Where in other programming dialects the space in code is for lucidness just, the space in Python is vital. Python utilizes space to show a square of code. if 5 > 2 :   print ( "Five is greater than two!" )   Python Variables In Python, factors are made when you relegate a worth to it: x = 5 y = "Hello, World!"   Python has no order for proclaiming a variable. Comments Python has remarking capacity with the end goal of in-code documentation. Remarks start with a #, and Python will deliver the remainder

Introduction to Python Programming

  Python is a well known programming language. It was made by Guido van Rossum, and delivered in 1991. It is utilized for:     web advancement (server-side),     programming advancement,     arithmetic,     framework prearranging. What else is there to do?     Python can be utilized on a server to make web applications.     Python can be utilized close by programming to make work processes.     Python can associate with information base frameworks. It can likewise peruse and alter documents.     Python can be utilized to deal with large information and perform complex arithmetic.     Python can be utilized for fast prototyping, or for creation prepared programming advancement. Why Python?     Python chips away at various stages (Windows, Mac, Linux, Raspberry Pi, and so on)     Python has a basic grammar like the English language.     Python has sentence structure that permits designers to compose programs with less lines than some other programming dialects.     Python runs on a tr

Python Problem- Find the Runner Up Score!!!

Problem Given the participants' score sheet for your University Sports Day, you are required to find the runner-up score. You are given scores. Store them in a list and find the score of the runner-up.   Source Code n =  int ( input ()) list1 =  list ( map ( int , input () .strip () .split ()))[: n ] list2 =  list ( set ( list1 )) list2.sort ( reverse =  True ) x = list2 [ 1 ] print ( x )

Python-HackerRank Problem List Comprehensions

Problem Print a list of all possible coordinates given by (i,j,k) on a 3D grid where the sum of i+j+k is not equal to  n. Here, 0<=i<=x;0<=j<=y;0<=k<=z. Please use list comprehensions rather than multiple loops, as a learning exercise.  Source Code   if  __name__ ==  '__main__' :     x =  int ( input ())     y =  int ( input ())     z =  int ( input ())     n =  int ( input ())      print   ([[ a , b , c ]   for  a  in   range ( 0 , x+1 )   for  b  in   range ( 0 , y+1 )   for  c  in   range ( 0 , z+1 )     if  a + b + c != n  ])                 

Flip-Flop

Image
SR FLIP-FLOP The SR Flip-Flop is bistable device having 2 inputs Set and Reset. The Set input (S) sets the device or produces the output 1, and the Reset input (R) resets the device or produces the output 0.  The Reset input is used to get back the flip flop to its original state from the current state with an output Q. This output depends on the set and reset conditions, which is either at the logic level 0 or 1.  The NAND Gate SR FLIP-FLOP We can implement the SR Flip-Flop by using two cross-coupled 2-input NAND gates together. In the SR Flip-Flop, from each output to one of the NAND gate inputs, feedback is connected. So, the device has two inputs, S and R and two outputs Q and Q'. The NAND Gate SR Flip-Flop is a basic Flip-Flop which provides feedback from both of its output back to its opposing inputs. This circuit is used to store single data bit in the memory circuit.So, the SR Flip-Flop. So, the SR Flip-Flop has three inputs, S , R and the output Q. The output Q is related

SR LATCH

Image
 SR Latch SR latch is also called as Set Reset Latch. This Latch effects the output as long as the Enable E is maintained at 1. The circuit has two inputs S and R. The circuit has two outputs Q(t) and Q'(t). The upper NOR Gate has two inputs R and the complement of the present state, Q(t)' and produces the next state Q(t+1) when Enable E is 1. Similarly the lower NOR Gate has two inputs S and present state Q(t) and produces the complement of the next state Q(t+1)' when Enable E is 1. We know that a two-input NOR Gate produces an output, which is the complement of the other output when one of the input is 0. Similarly produces 0 output, when one of the input is 1. When S is 1, the next state Q(t+1) has the value 1, irrespective of present state, Q(t) values. When R is 1, the next state Q(t+1) has the value 0, irrespective of present state, Q(t) values. At any time, both inputs cannot have the value 1, otherwise the value Q(t+1) is not defined. Table of SR-Latch: