Python program to merge two list.

How to start: Take two list from from the user. Then , merge two list and show the result. Source code: a=[]c=[]n1=int(input(“Enter number of elements:”)) for i in range(1,n1+1): b=int(input(“Enter element:”)) a.append(b)n2=int(input(“Enter number of elements:”)) for i in range(1,n2+1): d=int(input(“Enter element:”)) c.append(d) n=a+c new.sort()print(“Sorted list is:”,n) Output: Explanation: User input Continue Reading

Python Program to Print Table of a Given Number

How to do? Take input number(to form table) from the user . Process to make formation of table through lopping Source code: n=int(input(“Enter the no.to generate mul table:”))for i in range(1,12): print(n,”x”,i,”=”,n*i) Explanation: program ask user to input number to generate multiplication table. Program starts looping to generate table. Output:

Simple key press event using python

we can create simple key press event using python by binding the keys of the keyboard by using canvas.bind_allfunction .example: canvas.bind_all(‘<KeyPress-w>’,self.up) Here is the simple example of key bind function: from tkinter import * import time import random win=Tk() win.title(“game”) canvas=Canvas(win,width=500,height=500) canvas.pack() t=(“red”,”green”,”blue”,”grey”,”pink”,”black”,”yellow”,”orange”) class Bind():       def __init__(self,color,size):    Continue Reading