Forum Archive

Stampa a destra monty

cladocora

Buongiorno sono non nuovo nuovissimo. Sono alle prese con primi capitoli di pensare con un pc e con primi esercizi...
il 3.1 dice di scrivere funzione con argomento s e allineare stringa monty a destra con ultimo carattere la y.
Io ho fatto questo:

def stampaadestra(s):
    s='monty'
    print(s.rjust(65))
stampaadestra(1)

È giusto?

cladocora

@cladocora è troppo semplice?

cladocora

Is right or wrong the function above ? I'm new and I need help

Matteo

@cladocora Hi, in this forum you should ask anything using english lang, italian is not good in an international forum like this one. E scusami l'osservazione ma non era molto chiara neanche la domanda in italiano.

For your problem I suggest you to see here.

Short version: in your post
1. share your test script,
2. write output of your Pythonista after execution of the script,
3. write output you want if it is different from the one of point 2

Bye

cvp

@cladocora If I correctly understand you want to do this:

def stampaadestra(s):
    print(s.rjust(65))
stampaadestra('monty')
stampaadestra('python')

In your code, s was a numeric parameter (1) and you destroyed it by a string ('monty ').