Skip to content

Instantly share code, notes, and snippets.

"""
The function accepts three values representing ages: a, b, c and returns their sum.
Instructions
1. If the function is called without parameters, the default value of each age is 13.
2. If one of the values represents an age of adolescents between 13 and 19 (including them) but with the exception of ages 15 and 16 - fix its value using the function described below, so it is calculated as 0.
3. Write auxiliary function fix_age
"""
Write a program that gets the user a date in dd / mm / yyyy format and prints the day of the week for the entered date.
dd/mm/yyyy
calendar , weekday
"""
"""
Legend of "The Three Little Pigs" tells of three pigs that lived under the threat of a werewolf. With a view to providing shelter for themselves, they began to gather building materials together.
Write a plan that shows the total number of pigs collected by the pigs, and the number of bricks available to each pig, according to the instructions below.
Guidelines
The program will receive as a three-digit input (assume the input is correct). Each number in this number represents the number of bricks collected by another pig.
The program will print the following output:
1. The total number of bricks (the amount) collected by the piglets (ie the sum of the three digits)
2. The number of bricks that each pig will receive if they divide the total number of bricks equally among everyone
# We would like to connect chocolate cubes to a row x cm long. We have -
# - small chocolate cubes 1 cm long and 5 cm large chocolate cubes.
# The function receives the number of small cubes (small), the number of large cubes (big), -
# - and the desired line length (x). The function returns true -
# - if it is possible to create an x-length row using the number of all or part of the chocolate cubes received.
>>> chocolate_maker(3, 1, 8)
@roman-on
roman-on / gist:a0c719b9a5a07208da9ff1d36f87bafc
Created April 3, 2020 02:22
Convert Celsius to Fahrenheit and vise versa
# 50F 50f = 10C 10c
temp = str(input("Insert the temperature you would like to convert:"))
a = int(temp[:-1]) # num
b = temp[-1:] # c / C
c = int(temp[:-1]) # num
d = temp[-1:] # f / F
@roman-on
roman-on / PY0101EN-3-3-Functions.ipynb
Created December 2, 2019 03:12
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@roman-on
roman-on / PY0101EN-3-2-Loops.ipynb
Created November 26, 2019 02:19
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@roman-on
roman-on / PY0101EN-3-1-Conditions.ipynb
Created November 25, 2019 00:21
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@roman-on
roman-on / PY0101EN-2-4-Dictionaries.ipynb
Created November 22, 2019 01:28
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@roman-on
roman-on / PY0101EN-2-3-Sets.ipynb
Created November 20, 2019 03:03
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.