Question: I was making a project with Arduino Uno ,
It's working is like this it connects to a key pad and a 7segment display ,and when you press a run button connected to Arduino it should run the code written.

I don't want code for display and keypad but for executing a string like we can do in python- **exec("print (8)")**

Please help me and ask any information you need to solve it

Answer: 
Unless you want to implement some form of scripting engine, you can't.

Arduino code is compiled code, not interpreted code. There is no way of converting text into runnable code, since that is done by your computer at compile time, not by the Arduino at run-time.

The only thing you could possibly do is write some form of scripting engine which reads text and interprets it in some meaningful way to perform operations. That is not a trivial task, so you have to ask yourself: is this *really* what you want to do? Are you going about tackling your problem in the right way?
As stated in Majenko's answer, you would need an interpreter running on
the Arduino. Python is too large to run on an Uno, although [it can run
on some more powerful microcontrollers](https://micropython.org/).

A Web search for Arduino interpreters yields quite a few promising
options. I have not tested any of them:

* [Firmata](https://github.com/firmata/arduino)
* [Forth](https://flashforth.com/)
* another [Forth-ish language](https://github.com/tschaer/tofish)
* [Lisp](http://www.ulisp.com/)
* [BASIC](https://github.com/robinhedwards/ArduinoBASIC)
* a [C-like language](https://n.mtng.org/ele/arduino/iarduino.html)

The Forth language is quite popular when you need an interpreter with
minimal footprint.