-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathExercise_1_Basic_Python.py
More file actions
101 lines (59 loc) · 1.86 KB
/
Exercise_1_Basic_Python.py
File metadata and controls
101 lines (59 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# coding: utf-8
# In[2]:
#Name:
#Assignment: 1
#Date:
#Collaborators:
#Exercise 1: Basic Python
##########################################
# (A) Comments
##########################################
#This is a comment. Python will ignore it when you run the file.
"""This is also a comment. Made by 3 sets of double quotation marks."""
#Write your last name as a comment here:
#Now print your first name:
##########################################
# (B) Variables and Casting
##########################################
#Save your first name to a variable named "first"
#Save your last name to a variable named "last"
#Print out your full name by adding a space between both variables
##########################################
# Mathematical Operations
##########################################
#Choose a random number and assign it to a variable
#Assign double of the number to another variable (through multiplication of the first variable)
#Add 6
#Divide it in half
#Subtract the original number from the one you have now
#Print what you have left
##########################################
# Bonus: The Four Fours Challenge
##########################################
#Using the following operations only:
# + addition
# - subtraction or negation
# * multiplication
# / division
# ( ) parentheses for grouping
# ** power
#Your task: compute the following values using exactly four 4's
#You may also use 44 and 4.4 where each is considered to be two 4's
#Examples for zero:
zero = 4 / 4 * 4 - 4
zero2 = 44 - 44
#One
#Two
#Three
#Four
#Five
#Six
##########################################
# Bonus 2: More Four Fours
##########################################
#Seven
#Eight
#Nine
#Ten
#01000011 01000001 01000010 01001001 01001110 01000101 01010100 01010011
#00101101 00101101 00101101 00101101 00101101 00101101 00101101 00101101