top of page

Python Programming Help

Public·2 members

Python program to find highest of three numbers

Create a program, max3.py, that has a function that takes three integer arguments. The

program will then print out the highest of the three values.


def maxValues(first, second, third):

    if first > second:
        
        if second > third:
            print(first,"is the highest number")
            
    else:
        if second > third:
            print(second,"is the highest number")
        else:
            print(third,"is the highest number")

Method called


maxValues(10, 39, 20)
maxValues(10, 20, 30)
maxValues(50, 39, 20)

Output


61 Views

Python Program to calculate the total value of that change

Create a program, change.py, that has a function that takes 4 arguments that

correspond to the number of quarters, dimes, nickels, and pennies, respectively.

Calculate the total value of that change, and print "The total value of your change is $x"

where x is equal to the total value.


Hints:

A penny is worth 1 cent.


1369 Views

Chat Program two way communication In Python

Chat Program two way communication | Socket Programming in Python


Socket Programming in Python - Chat Application
Socket Programming in Python

Server.py

import socket
server_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
LOCALHOST = '127.0.0.1'
port = 9990

server_socket.bind((LOCALHOST,port))
server_socket.listen(5)

print("Server started...")

client_sockets,addr=server_socket.accept()
while True:
    msg_received = client_sockets.recv(1024)
    msg_received = msg_received.decode()
    print("Client:", msg_received)
    
    msg_send = input("Me:")
    client_sockets.send(msg_send.encode("ascii"))

client_sockets.close()

Client.py


2398 Views

Socket Programming in Python


What is Socket?


Socket in a term used in network programming most commonly said as Node. Almost every programming language like C, C++, Java or Python etc have capability to connect multiple system connected with each other by the purpose of sending or receiving message or communicating with the socket. Sockets are used nearly everywhere.

so, in the most simple term we can say socket is medium through which we can connect through any port no. Computer have different types of port available to connect with other machine in network. similarly all website over internet has available port that's why we can open any website and see the content else not possible to open any website if doesn't have any public port.


Every public websites have port 80 open for HTTP access, port 22 for SSH (Secure shell), 20 and 21 open for File transfer Protocol (FTP) and website with…


355 Views
bottom of page