File tree 2 files changed +17
-19
lines changed
2 files changed +17
-19
lines changed Original file line number Diff line number Diff line change @@ -17,14 +17,14 @@ def calculate_age(birthday):
17
17
return age_string
18
18
19
19
if __name__ == "__main__" :
20
- print (" Age Calculator By Python" )
20
+ print (" Age Calculator By Python" )
21
21
22
- try :
23
- birthYear = int (input ("Enter the birth year: " ))
24
- birthMonth = int (input ("Enter the birth month: " ))
25
- birthDay = int (input ("Enter the birth day: " ))
26
- dateOfBirth = date (birthYear , birthMonth , birthDay )
27
- age = calculate_age (dateOfBirth )
28
- print (age )
29
- except ValueError :
30
- print ("Invalid input. Please enter valid integers for the year, month, and day." )
22
+ try :
23
+ birthYear = int (input ("Enter the birth year: " ))
24
+ birthMonth = int (input ("Enter the birth month: " ))
25
+ birthDay = int (input ("Enter the birth day: " ))
26
+ dateOfBirth = date (birthYear , birthMonth , birthDay )
27
+ age = calculate_age (dateOfBirth )
28
+ print (age )
29
+ except ValueError :
30
+ print ("Invalid input. Please enter valid integers for the year, month, and day." )
Original file line number Diff line number Diff line change 1
1
# decimal to hexa decimal converter
2
-
3
2
if __name__ == "__main__" :
4
3
print ('decimal to hexa-decimal converter using python' )
5
4
def decimal_to_hexadecimal ():
6
5
try :
7
- decimal_input = int (input ("Enter a decimal number: " ))
8
- hexadecimal_output = hex (decimal_input )
9
- return hexadecimal_output
6
+ decimal_input = int (input ("Enter a decimal number: " ))
7
+ hexadecimal_output = hex (decimal_input )
8
+ return hexadecimal_output
10
9
except ValueError :
11
- raise ValueError ("Invalid input. Please enter a valid decimal number." )
12
-
10
+ raise ValueError ("Invalid input. Please enter a valid decimal number." )
13
11
try :
14
- hexadecimal_number = decimal_to_hexadecimal ()
15
- print (hexadecimal_number )
12
+ hexadecimal_number = decimal_to_hexadecimal ()
13
+ print (hexadecimal_number )
16
14
except ValueError as e :
17
- print (str (e ))
15
+ print (str (e ))
18
16
19
17
You can’t perform that action at this time.
0 commit comments