#! /usr/bin/env python # -*- coding: UTF-8 -*- """ Exp: programma per calcolare un numero esponenziale fatto da Frafra (francesco.it@gmail.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. """ # Descrizione del file __module_name__ = "Exp" __module_version__ = __revision__ = versione = "1.0" __module_description__ = "Calcola un numero esponenziale" x = 0 while not x: # Input num = raw_input("Inserisci un numero esponenziale: ") # Calcolo try: if "exp" in num: num = num.split("exp") elif "e" in num: num = num.split("e") for x in range(len(num)): if "," in num[x]: num[x] = num[x].replace(",", ".") if "." in num[x]: num[x] = float(num[x]) else: num[x] = int(num[x]) x = 1 # Eccezione except: print "Formato non valido. Es:" print "45e-2, 7.8exp2,4 e simili." # Visualizzazione print "Risolto รจ: " + str(num[0]*10**num[1])