FP: Extra3 - Ex11 simplification

ISD: Quick fix
This commit is contained in:
TiagoRG 2023-01-18 19:02:26 +00:00
parent fdabf59c73
commit b5ac6aa74d
Signed by untrusted user who does not match committer: TiagoRG
GPG Key ID: DFCD48E3F420DB42
4 changed files with 8 additions and 9 deletions

View File

@ -6,5 +6,11 @@
- [Introdução à Engenharia Informática](https://github.com/TiagoRG/uaveiro-leci/tree/master/1ano/iei) | Ano de conclusão: 2022/2023
- [Introdução aos Sistemas Digitais](https://github.com/TiagoRG/uaveiro-leci/tree/master/1ano/isd) | Ano de conclusão: 2022/2023
### 2º Semestre
- [Programação Orientada a Objetos](https://github.com/TiagoRG/uaveiro-leci/tree/master/1ano/poo)
- [Laboratórios de Informática](https://github.com/TiagoRG/uaveiro-leci/tree/master/1ano/labi)
- [Laboratório de Sistemas Digitais](https://github.com/TiagoRG/uaveiro-leci/tree/master/1ano/lsd)
---
*Pode conter erros, caso encontre algum, crie um* [*ticket*](https://github.com/TiagoRG/uaveiro-leci/issues/new)

View File

@ -1,11 +1,4 @@
def onlyCaps(s):
# NOTE: ch.isupper() -> True if ch is uppercase.
if len(s) == 0:
return ""
if len(s) == 1:
return s if s.isupper() else ""
return s[0] + onlyCaps(s[1:]) if s[0].isupper() else onlyCaps(s[1:])
return (s if len(s) == 0 or (len(s) == 1 and s.isupper()) else "") if len(s) <= 1 else (s[0] + onlyCaps(s[1:]) if s[0].isupper() else onlyCaps(s[1:]))
print(onlyCaps("John Fitzgerald Kennedy"))
print(onlyCaps(""))

View File

@ -1,3 +1,3 @@
Quartus_Version = Version 20.1.1 Build 720 11/11/2020 SJ Lite Edition
Version_Index = 520278016
Creation_Time = Thu Dec 1 16:34:59 2022
Creation_Time = Wed Jan 18 13:25:36 2023