I cannot save scripts accentuated (Python)

Asked

Viewed 111 times

0

Hello, everyone. I’m a beginner in python (and programming in general) and I’m trying to learn from small, easy code. I was trying to make a script and I noticed that when I wanted to save it just didn’t save and didn’t go to the folder I wanted (no error text appears). When I removed the accent, it came back up and saved. The code I made was:

dia=input('Dia:')
mes=input('Mês:')
ano=input('Ano:')
print('Você nasceu no dia',dia,'de',mes,'de',2005,'. Correto?')

the code I made to solve was:

dia=input('Dia:')
mes=input('Mes:')
ano=input('Ano:')
print('Voce nasceu no dia',dia,'de',mes,'de',2005,'. Correto?')
  • You can try to change the default encoding. Which Operating System you are using?

1 answer

0

Maybe you were unable to save the script on File Encoding wrong on your Operating System, Text Editor and/or IDE. Try changing File Encoding to default UTF-8.

About your code, you left the variable ano redundant using 2005 in the structure of print(). In addition, you can use f-strings to make your code more 'pythonic' as follows:

dia = input('Dia:')
mes = input('Mês:')
ano = input('Ano:')
print(f'Você nasceu no dia {dia} do mês {mes} de {ano}. Correto?')

Browser other questions tagged

You are not signed in. Login or sign up in order to post.