print(' ') print('----- CALCULADORA DE NOTAS PÓDION -----') print(' ') print('Selecione uma calculadora:') print(' ') print('(1) Calcular quanto precisa tirar no 4° bimestre para passar de ano.') print('(2) Calcular quanto precisa tirar na prova bimestral para ficar acima da média.') print('(3) Calcular a média geral anual.') print('(4) Descobrir a porcentagem de acertos de qualquer prova.') print('(5) Descobrir a nota final do bimestre.') print(' ') decisão = float(input('Entrada: ')) print(' ') if decisão == 1 or decisão == 2 or decisão == 3 or decisão == 4 or decisão == 5: print('OK!') if decisão == 1: print(' ') mg1 = float(input('Digite sua nota geral do 1° bimestre (0 - 10): ')) mg2 = float(input('Digite sua nota geral do 2° bimestre (0 - 10): ')) mg3 = float(input('Digite sua nota geral do 3° bimestre (0 - 10): ')) if mg1 >= 0 and mg1 <= 10 and mg2 >= 0 and mg2 <= 10 and mg3 >= 0 and mg3 <= 10: mg4 = ((mg1 * 2 + mg2 * 2 + mg3 * 3 - 60) / 3) * -1 if mg4 <= 0: print('Parabéns, você passou de ano! Você precisaria de {:.3f} para passar!'.format(mg4)) elif mg4 >= 0 and mg4 <= 10: print('Você ainda não passou de ano. Basta tirar {:.3f} no 4° bimestre que você passa.'.format(mg4)) else: print('Você ficou de recuperação por {:.3f} pontos.'.format(mg4 - 10)) else: print('Digite um valor válido.') elif decisão == 2: print(' ') pp = float(input('Digite quanto você tirou na prova parcial (0 - 10): ')) if pp >= 0 and pp <= 10: pb = (6 - pp * 0.4) / 0.6 print('Você precisará tirar no mínimo {:.3f} na prova bimestral para ficar acima da média.'.format(pb)) else: print('Digite uma nota válida.') elif decisão == 3: print(' ') artes = float(input('Digite sua média geral de artes (0 - 10): ')) bio = float(input('Digite sua média geral de biologia (0 - 10): ')) ef = float(input('Digite sua média geral de educação física (0 - 10): ')) filosofia = float(input('Digite sua média geral de filosofia (0 - 10): ')) fisica = float(input('Digite sua média geral de física (0 - 10): ')) geo = float(input('Digite sua média geral de geografia (0 - 10): ')) his = float(input('Digite sua média geral de história (0 - 10): ')) ing = float(input('Digite sua média geral de inglês (0 - 10): ')) mat = float(input('Digite sua média geral de matemática (0 - 10): ')) port = float(input('Digite sua média geral de português (0 - 10): ')) quim = float(input('Digite sua média geral de química (0 - 10): ')) red = float(input('Digite sua média geral de redação (0 - 10): ')) soc = float(input('Digite sua média geral de sociologia (0 - 10): ')) calc = (artes + bio + ef + filosofia + fisica + geo + his + ing + mat + port + quim + red + soc)/13 if artes >= 0 and artes <= 10 and bio >=0 and bio <= 10 and ef >= 0 and ef <= 10 and filosofia >= 0 and filosofia <= 10 and fisica >= 0 and fisica <= 10 and geo >= 0 and geo <= 10 and his >= 0 and his <= 10 and ing >= 0 and ing <= 10 and mat >= 0 and mat <= 10 and port >= 0 and port <= 10 and quim >= 0 and quim <= 10 and red >= 0 and red <= 10 and soc >= 0 and soc <= 10: if calc >= 8.5 and calc <= 10: print('Parabéns, sua média geral foi {:.3f}.'.format(calc)) elif calc < 8.5 and calc >= 0: print('Sua média geral foi {:.3f}. Dá pra melhorar!'.format(calc)) else: print('Digite valores válidos.') elif decisão == 4: print(' ') itprova = float(input('Digite quantos itens tinha na prova: ')) acertos = float(input('Digite quantos itens você acertou: ')) porc = (acertos/itprova) * 100 if acertos <= itprova: if porc > 60: print('Sua porcentagem de acertos foi de {:.1f}%. Você ficou acima da média.'.format(porc)) elif porc == 60: print('Sua porcentagem de acertos foi de {:.1f}%. Você ficou na média.'.format(porc)) else: print('Sua porcentagem de acertos foi de {:.1f}%. Você ficou abaixo da média.'.format(porc)) else: print(' ') print('Digite valores válidos. É impossível acertar mais do que havia na prova...') elif decisão == 5: print(' ') provaparcial = float(input('Digite quanto você tirou na Prova Parcial: ')) provabimestral = float(input('Digite quanto você tirou na Prova Bimestral: ')) notafinaldobi = ((provaparcial*0.4) + (provabimestral*0.6)) print('Sua nota final do bimestre foi {:.3f}.'.format(notafinaldobi)) else: print('Digite um valor válido.')
Write, Run & Share Python code online using OneCompiler's Python online compiler for free. It's one of the robust, feature-rich online compilers for python language, supporting both the versions which are Python 3 and Python 2.7. Getting started with the OneCompiler's Python editor is easy and fast. The editor shows sample boilerplate code when you choose language as Python or Python2 and start coding.
OneCompiler's python online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample python program which takes name as input and print your name with hello.
import sys
name = sys.stdin.readline()
print("Hello "+ name)
Python is a very popular general-purpose programming language which was created by Guido van Rossum, and released in 1991. It is very popular for web development and you can build almost anything like mobile apps, web apps, tools, data analytics, machine learning etc. It is designed to be simple and easy like english language. It's is highly productive and efficient making it a very popular language.
When ever you want to perform a set of operations based on a condition IF-ELSE is used.
if conditional-expression
#code
elif conditional-expression
#code
else:
#code
Indentation is very important in Python, make sure the indentation is followed correctly
For loop is used to iterate over arrays(list, tuple, set, dictionary) or strings.
mylist=("Iphone","Pixel","Samsung")
for i in mylist:
print(i)
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while condition
#code
There are four types of collections in Python.
List is a collection which is ordered and can be changed. Lists are specified in square brackets.
mylist=["iPhone","Pixel","Samsung"]
print(mylist)
Tuple is a collection which is ordered and can not be changed. Tuples are specified in round brackets.
myTuple=("iPhone","Pixel","Samsung")
print(myTuple)
Below throws an error if you assign another value to tuple again.
myTuple=("iPhone","Pixel","Samsung")
print(myTuple)
myTuple[1]="onePlus"
print(myTuple)
Set is a collection which is unordered and unindexed. Sets are specified in curly brackets.
myset = {"iPhone","Pixel","Samsung"}
print(myset)
Dictionary is a collection of key value pairs which is unordered, can be changed, and indexed. They are written in curly brackets with key - value pairs.
mydict = {
"brand" :"iPhone",
"model": "iPhone 11"
}
print(mydict)
Following are the libraries supported by OneCompiler's Python compiler
Name | Description |
---|---|
NumPy | NumPy python library helps users to work on arrays with ease |
SciPy | SciPy is a scientific computation library which depends on NumPy for convenient and fast N-dimensional array manipulation |
SKLearn/Scikit-learn | Scikit-learn or Scikit-learn is the most useful library for machine learning in Python |
Pandas | Pandas is the most efficient Python library for data manipulation and analysis |
DOcplex | DOcplex is IBM Decision Optimization CPLEX Modeling for Python, is a library composed of Mathematical Programming Modeling and Constraint Programming Modeling |