Conversione a stringa in Python

Per convertire un numero in una stringa, è necessario applicare la funzione str. Usiamola per creare una stringa da un numero:

pythontest1 = 'abc'
test2 = 1

test3 = test1 + str(test2)
print(test3) # visualizzerà 'abc1'
Задание 1

Sono date le variabili:

pythonnum1 = 1
num2 = 2

Somma queste variabili come stringhe:

python'12'
Задание 2

Sono date le variabili:

pythontst1 = 'abc'
txt2 = 123

Somma queste variabili come stringhe:

python'abc123'
Задание 3

È dato il numero:

pythontst = 123

Trova il numero di cifre di questo numero.

Задание 4

È dato il numero:

pythontst = 456

Trova la somma delle cifre di questo numero.