
									 Problem
								
								
									 Solution
								
								
									 Submissions
								
								
							Print the ASCII Value of a Character
								Certification: Basic Level
								Accuracy: 95.87%
								Submissions: 121
								Points: 5
							
							Write a Python program that prints the ASCII value of a given character.
Example 1
- Input: character = 'A'
- Output: 65
- Explanation: 
- Step 1: Take the character 'A' as input.
- Step 2: Use the ord() function to get the ASCII value.
- Step 3: Print the ASCII value 65.
 
Example 2
- Input: character = 'a'
- Output: 97
- Explanation: 
- Step 1: Take the character 'a' as input.
- Step 2: Use the ord() function to get the ASCII value.
- Step 3: Print the ASCII value 97.
 
Constraints
- Input is a single valid ASCII character
- Time Complexity: O(1)
- Space Complexity: O(1)
Editorial
									
												
My Submissions
										All Solutions
									| Lang | Status | Date | Code | 
|---|---|---|---|
| You do not have any submissions for this problem. | |||
| User | Lang | Status | Date | Code | 
|---|---|---|---|---|
| No submissions found. | ||||
Solution Hints
- Use ord() function: ascii_value = ord(char)
- Check if input is a single character: if len(char) == 1: ascii_value = ord(char)
- Handle exceptions: try: ascii_value = ord(char) except TypeError: print("Input should be a character")
