Wednesday, September 14, 2022

Python Program to Make a Simple Calculator

 # Program make a simple calculator


# This function adds two numbers

def add(x, y):

    return x + y


# This function subtracts two numbers

def subtract(x, y):

    return x - y


# This function multiplies two numbers

def multiply(x, y):

    return x * y


# This function divides two numbers

def divide(x, y):

    return x / y



print("Select operation.")

print("1.Add")

print("2.Subtract")

print("3.Multiply")

print("4.Divide")


while True:

    # take input from the user

    choice = input("Enter choice(1/2/3/4): ")


    # check if choice is one of the four options

    if choice in ('1', '2', '3', '4'):

        num1 = float(input("Enter first number: "))

        num2 = float(input("Enter second number: "))


        if choice == '1':

            print(num1, "+", num2, "=", add(num1, num2))


        elif choice == '2':

            print(num1, "-", num2, "=", subtract(num1, num2))


        elif choice == '3':

            print(num1, "*", num2, "=", multiply(num1, num2))


        elif choice == '4':

            print(num1, "/", num2, "=", divide(num1, num2))

        

        # check if user wants another calculation

        # break the while loop if answer is no

        next_calculation = input("Let's do next calculation? (yes/no): ")

        if next_calculation == "no":

          break

    

    else:

        print("Invalid Input")

Saturday, November 30, 2013

Spotify for Linux

Debian

# 1. Add this line to your list of repositories by
#    editing your /etc/apt/sources.list
deb http://repository.spotify.com stable non-free

# 2. If you want to verify the downloaded packages,
#    you will need to add our public key
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 94558F59

# 3. Run apt-get update
sudo apt-get update

# 4. Install spotify!
sudo apt-get install spotify-client

Wine 1.7.5 Released, Install it in Ubuntu 13.10, 13.04, 12.04

What’s new in Wine 1.7.5:
  • Support for registration-free COM using activation contexts.
  • Improved support for simulated bold fonts.
  • Unicode data updated to Unicode 6.3.
  • Better support for typelib registration on 64-bit.
  • Various bug fixes.
Bugs fixed in 1.7.5:
  • Wine doesnt show embedded web browser interface on Clarion applications
  • Crash when creating a DC
  • url.dll FileProtocolHandler does not open URLs in browser.
  • Main Steam window disappears when entering Exposé
  • Bioshock not work
  • Risen – No space between words in Risen
  • GetTabbedTextExtent() returns non-zero value when nCount == 0
  • chromium-based apps can’t load https sites
  • wine iexplore can’t load hotmail.com (gives a blank page)
  • Steam freezes
  • Internet Explorer 8 fails to submit a URL to VirusTotal for analysis
  • Spotify crashes on startup
  • GOG.com version of Soulbringer crashes on startup (GetModuleHandleExW needs to support GET_MODULE_HANDLE_EX_FLAG_PIN)
  • 32-bit Visual C++ 2010 Express full installer complains “Unknown Error” with Mono (mscoree CLR v4 shim needs CreateInterface)
  • Basic WPF applications using .NET 3.5 WPF fails to handle images (windowscodecs {7543696a-bc8d-46b0-5f81-8d95728972be} = IMILBitmapSource unsupported)
  • Wargame: Airland Battle needs msvcr110.dll._libm_sse2_atan_precise
  • installer of iTudou needs atl90
  • window titlebar names
  • Fullscreen Window scaling issue (MacDriver)
  • __unDName doesn’t use flags UNDNAME_NO_LEADING_UNDERSCORES and UNDNAME_NO_MS_KEYWORDS for “__ptr64″
  • __unDName doesn’t support flag UNDNAME_NO_THISTYPE
  • J2SE Runtime Environment 5.0 Update 10 installer ‘patchjre’ tool crashes due to unbuffered io on redirected stdout pipe
  • e-carte bleue la banque postale doesn’t work at all
  • Miranda crashes on start up
  • cabinet_open{,_stream} returns 0 on failure but doesn’t compliant to _open interface
  • Photoscape: crashes selecting some filters
  • PageFault when generating a MD5 Hash
  • Tray icons don’t attach to the native notification area
  • explorer.exe does not start
  • IE7 can’t install
How to Install

Open the terminal then enter

sudo add-apt-repository ppa:ubuntu-wine/ppa

sudo apt-get update

sudo apt-get install wine1.7

Saturday, November 23, 2013

Turn On Hibernate On Ubuntu 13.10

First, open the terminal

sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

Paste the following and save the file.

[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate
ResultActive=yes
 
 
Restart the machine. Then run sudo killall indicator-session-service once 
you've entered a new session, and then you'll have your hibernate functionality back. 

Tuesday, August 7, 2012

Install NitroShare

sudo add-apt-repository ppa:george-edison55/nitroshare
Sudo apt-get update
Sudo apt-get install nitroshare

Install LightRead

sudo add-apt-repository ppa:cooperjona/lightread
sudo apt-get update
sudo apt-get install lightread