Cheatography
https://cheatography.com
Include all the functions, vocabulary and other important concepts you have learned in Python so far.
Terms/Functions or DefinitionInt (Integers) | A thing complete in itself | Variable | Something that can be change | Elif | Else/If | Float | Number including all the decimals | mynum%2 | What is the remainder when dividing by 2 | ** | Square (the number) | == | Equal to... | != | NOT equal to... | Decimals in Python... | Any decimal in python, it will get rid of all except for the 'floats' command | " " | Anything puts under the quotes, will turn into 'INTEGERS' | len | length (e.g. length of words) | str | String | String | text you want to display to someone, or "export" out of the program you are writing | List | Contains many words | Input | Allow the user to type in/input something | # | Comments only (it does not interfered or have any affect with the commands in the programs) |
Area of Circle"""
Python Intro Assignment #2
name
student number
"""
#Ask the user for a radius of a circle
user_radius = input("What is a radius of a circle?")
#Convert the given radius to a floating point
radius = float(user_radius)
#Make a variable called pi
pi = float(3.1415)
#Calculate the area of the circle using exponents
area = pi(radius*2)
#Display the area of the circle to the user
print ("The area of the circle is", area)
| | VolcabuaryString | A list of character such as number, letter and symbols ("Under quotes" | Variable | Hold a value and can be change | Integer Number | Whole number (Can be positive or negative) | Floating Point | The number with decimals | Syntax | Grammar/Structure of Language | Modulo | Find the reminder | Boolean | True/False |
Countdown Machineuser_number = input("What number do you want to count down? ")
number = int(user_number)
countdown_string = ' '
while number > 0:
countdown_number = countdown_string + str(number) + " "
number = number - 1
#print(number)
print (countdown_string)
Covert Decimal to Binaryuser_number = '' while user_number != '0' : user_number = input("Enter a number to convert to binary") number = int(user_number) binary_string = '' while(number>0) : remainder = number/2 binary_string = str(remainder) + binary_string number = number//2 print ("Binary string is", binary_string) |
Multiplication and Exponentsstring * number | Combine that string | string * string | Crash | number * number | Math - MULTIPLY | string ** string | Crash | number ** number | Math - EXPONENT | string ** number | Crash |
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets