Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Execute Python-3 Online

# ejercicio 4.2

def main():
    ingreso=3 #int(input("Ingrese numero entero: "))
    mini=ingreso
    maxi=ingreso
    while ingreso!=0:
        if maxi<ingreso:
            maxi=ingreso
        if mini>ingreso:
            mini=ingreso
        ingreso=3 #int(input("Ingrese numero entero: "))
    print(mini,maxi)

main()


'''
# ejercicio 4.1

def main():
    ingreso=0 # los numeros que se ingresan
    cont=0    # contador para numeros pares
    while cont<5:
        ingreso=3#int(input("Ingrese numero entero: "))
        cont=condicion(ingreso)
        
    
def condicion(ingreso):
    cont=0
    if (ingreso % 2) == 0:
            cont=cont+1
            print("Numero Par. ", end="")
            if ingreso % 4 == 0:
                print("Tambien es multiplo de 4.", end="")
            print("Total de numeros pares ingresados",cont)
    
    return cont

main()
'''

Somma interi non divisibili 7

# Somma gli interi da 1 al numero dato in input escludendo
# quelli divisibili per 7
# Richiede in input un numero maggiore di 100

inputValue = "0"
sum = 0
while int(inputValue) < 100:
    inputValue = input("\nInserire un numero maggiore di 100: ")
for i in range(1, int(inputValue)):
    if i%7 != 0:
        sum = sum + i
print ("\nLa somma dei numeri non divisibili per 7 è:", sum)

Execute Python-3 Online

# Hello World program in Python
    
def calc_sum() :
#   a = 3
#   b = 4
#   c = 5
   a = int(input())
   b = int(input())
   c = int(input())
   print ('Sum is:', a + b + c)
#print ("Hello World!");

calc_sum ()

Execute Python-3 Online

import webbrowser
#name input
#input favourite song
favsong=input("What is your favourite song? ")
#print opinion
print("Very good, I also like that song, but it's not my favourite.")
#input yes or no
yn=input("Do you want to listen to some popular songs?")

#url directory
url1 = 'https://www.youtube.com/watch?v=JGwWNGJdvx8'
url2 = 'https://www.youtube.com/watch?v=fyaI4-5849w'
url3 = 'https://www.youtube.com/watch?v=kJQP7kiw5Fk'
url4 = 'https://www.youtube.com/watch?v=7Qp5vcuMIlk'
url5 = 'https://www.youtube.com/watch?v=nfs8NYg7yQM'
url6 = 'https://www.youtube.com/watch?v=qPTfXwPf_HM'
url7 = 'https://www.youtube.com/watch?v=aatr_2MstrI'
url8 = 'https://www.youtube.com/watch?v=vSW2M-BB1NE'
url9 = 'https://www.youtube.com/watch?v=IhP3J0j9JmY'
url10 = 'https://www.youtube.com/watch?v=GsF05B8TFWg'
url11 = 'https://www.youtube.com/watch?v=e2vBLd5Egnk'


#if else
if yn.lower()=="yes":
#print the possible solutions
    print("Shape of you = a \nWild thought = b \nDespacito = c \nCastle on the Hill = d \nAttention = e \nMama = f \nSymphony = g \nStrip that Down = h \nBeliever = i \nMore than you know = j \nScared to be Lonely = k")
#input letter
    songch=input("Choose the song you want to listen to from above. Use letters!") 

#song choice
    if songch=="a":
        webbrowser.get('chrome').open_new (url1)

    elif songch=="b":
        webbrowser.get('chrome').open_new(url2)

    elif songch=="c":
        webbrowser.get('chrome').open_new(url3)

    elif songch=="d":
        webbrowser.get('chrome').open_new(url4)

    elif songch=="e":
        webbrowser.get('chrome').open_new(url5)

    elif songch=="f":
        webbrowser.get('chrome').open_new(url6)

    elif songch=="g":
        webbrowser.get('chrome').open_new(url7)

    elif songch=="h":
        webbrowser.get('chrome').open_new(url8)

    elif songch=="i":
        webbrowser.get('chrome').open_new(url9)

    elif songch=="j":
        webbrowser.get('chrome').open_new(url10)

    elif songch=="k":
        webbrowser.get('chrome').open_new(url11)

    else:
        print("Your request was invalid!")

#goodbye message
else:
    print("Thank you for using our musicbot.")
    
      

test2

# Hello World program in Python
    
#def calc_sum() :
#   a = 3
#   b = 4
#   c = 5
#   a = int(input())
#   b = int(input())
#   c = int(input())
#   print ('Sum is:', a + b + c)
#print ("Hello World!");
#
#calc_sum ()
def process_file (infile,outfile):
   
   f_in=open(infile,"r+")
   str=f_in.read()
   print ("Read String is : ", str)
# Close opened file
   f_in.close()
   f_out=open(outfile,"w")
   f_out.write("new w+ file\n"+str)
   f_out.close()

process_file('infile.txt','outfile.txt')   
   

Execute Python-3 Online

# Hello World program in Python
    
print ("Hello World!");

6478

# Hello World program in Python
    
str_seconds = input("Please enter the number of seconds you wish to convert")
total_secs = int(str_seconds)

hours = total_secs // 3600
secs_still_remaining = total_secs % 3600
minutes =  secs_still_remaining // 60
secs_finally_remaining = secs_still_remaining  % 60

print("Hrs=", hours, "mins=", minutes, "secs=", secs_finally_remaining)

Wholesale Cost?

# What is the total wholesale cost for 60 copies?

cover_price = 24.95
bookstore_discout = 0.40
shipping_costs = 3
additional_copies = 0.75
number_of_copies = 60


bookstore_discout_answer = cover_price * bookstore_discout
shipping_costs_answer = shipping_costs
additional_copies_answer = additional_copies * (number_of_copies - 1)

total =  (bookstore_discout_answer * 60) + shipping_costs + additional_copies_answer

print(total)
print("%.2f" % total)
print(round(total, 2))

Execute Python-3 Online

#Simple Calculator
num1 = int(input("Enter a number: "))
num2 = int(input("Enter another number: "))
choice = input("Do you want to add, subtract, multiply, or divide? ")
if choice.upper() == "ADD":
 answer = num1 + num2
 print(num1, "+", num2, "=", answer)
elif choice.upper() == "SUBTRACT":
 answer = num1 - num2
 print(num1, "-", num2, "=", answer)
elif choice.upper() == "MULTIPLY":
 answer = num1 * num2
 print(num1, "*", num2, "=", answer)
elif choice.upper() == "DIVIDE":
 answer = num1 / num2
 print(num1, "/", num2, "=", answer)
else:
 print("Invalid input. Sorry!")

Hello World!

# Hello World program in Python
    
print("Hello World!")
print('Hello World!')
print("""Hello World!""")
print('''Hello World!''')
print('''Hello
World!''')


"""
x = 555  # Hacker's way of coding out code!
print(x) # Code between triple quotes will be skipped by Python
5 + 22   
"""

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.