user71342: 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

user7508: 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.
A Web search for Arduino interpreters yields quite a few promising
options. I have not tested any of them:

Firmata
Forth
another Forth-ish language
Lisp
BASIC
a C-like language

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

user4143: 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?

71342: <p>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.</p>
<p>I don't want code for display and keypad but for executing a string like we can do in python- <strong>exec(&quot;print (8)&quot;)</strong></p>
<p>Please help me and ask any information you need to solve it</p>
 7508: <p>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 <a href="https://micropython.org/" rel="nofollow noreferrer">it can run
on some more powerful microcontrollers</a>.</p>
<p>A Web search for Arduino interpreters yields quite a few promising
options. I have not tested any of them:</p>
<ul>
<li><a href="https://github.com/firmata/arduino" rel="nofollow noreferrer">Firmata</a></li>
<li><a href="https://flashforth.com/" rel="nofollow noreferrer">Forth</a></li>
<li>another <a href="https://github.com/tschaer/tofish" rel="nofollow noreferrer">Forth-ish language</a></li>
<li><a href="http://www.ulisp.com/" rel="nofollow noreferrer">Lisp</a></li>
<li><a href="https://github.com/robinhedwards/ArduinoBASIC" rel="nofollow noreferrer">BASIC</a></li>
<li>a <a href="https://n.mtng.org/ele/arduino/iarduino.html" rel="nofollow noreferrer">C-like language</a></li>
</ul>
<p>The Forth language is quite popular when you need an interpreter with
minimal footprint.</p>
 4143: <p>Unless you want to implement some form of scripting engine, you can't.</p>
<p>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.</p>
<p>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 <em>really</em> what you want to do? Are you going about tackling your problem in the right way?</p>
