Files
openai--openai-agents-python/examples/basic
Abbas Asad 65cb91ce26 Add input validation and type conversion for user input (#1462)
## Summary

Fixed a type safety issue where user input was being used as a string
without conversion to integer, which could cause runtime errors and type
mismatches.

## Problem

The code was using `input()` which returns a string, but then using it
directly in the f-string without converting it to an integer. This could
cause:
- Type mismatches when the string is passed to functions expecting
integers
- Runtime errors when users enter non-numeric input
- Inconsistent behavior with the function signature expectations

## Changes Made

Added proper input validation and type conversion:
- Wrapped the input processing in a try-except block
- Convert user input to integer using `int(user_input)`
- Added error handling for invalid input with user-friendly message
- Used the converted integer value in the f-string instead of raw string
input

This ensures type safety and provides better user experience with proper
error handling.
2025-08-14 12:33:22 +09:00
..
2025-04-21 11:14:25 -04:00
2025-03-11 09:42:28 -07:00
2025-03-11 09:42:28 -07:00
2025-06-16 15:47:48 -04:00
2025-03-11 09:42:28 -07:00
2025-03-11 09:42:28 -07:00
2025-03-18 21:55:12 -04:00