Click here to Skip to main content
15,887,083 members

Comments by Rodion Mikhailov (Top 2 by date)

Rodion Mikhailov 21-Feb-20 2:01am View    
Thank you very much, this helped.
I needed to not just assign a variable, but make s´that was integer. So here's what I've done. Is it good ? It works.

month1 = input("Enter your month's of birth number: ")
try:
month1 = int(month1)
day1 = int(input("Enter your day of birth: "))
year1 = int(input("Enter your year of birth: "))
print("You were born in " + months_by_number[month1] + " " + str(day1) + " " + str(year1))
except ValueError:
print("You had to enter a NUMBER !")
except KeyError:
print("There are 12 month, not " + str(month1))
Rodion Mikhailov 13-Feb-20 5:20am View    
I see, so then it must work well with while-loop:

def raise_to_power2(base2, power2):
    i = 0
    result2 = 1
    while i < power2:
        result2 = result2 * base2
        i = i + 1
    print(result2)


raise_to_power2(5, 6)