What do you want to save?
Add Code snippet
New code examples
-
Python 2022-01-30 19:31:20
how to convert dollars to rupees and rs to dollar in python
print('hello welcome to converter of rs to dollar and dollar to rs') print() carry_on = True while carry_on: try: ask = int(input('write what do you want to do find? for finding dollar to rs type "1" or to find rs to dollar write... Add solution -
Python 2022-01-27 22:05:02
add 3 years to a given date in python code
import datetime from datetime import date def addYears(d, years): try: #Return same day of the current year return d.replace(year = d.year + years) except ValueError: #If not same day, it will return other, i.e. February 29 to Mar... Add solution -
Python 2022-01-22 04:40:02
python check if input() gives error
try: # Note: Python 2.x users should use raw_input, the equivalent of 3.x's input age = int(input("Please enter your age: ")) except ValueError: print("Sorry, I didn't understand that.") else: if age >= 18: print(... Add solution -
Python 2021-12-23 17:20:09
how to get int input in python
# To prompt the user to input an integer we do the following: valid = False while not valid: #loop until the user enters a valid int try: x = int(input('Enter an integer: ')) valid = True #if this point is reached, x is a valid int ... Add solution