-
Notifications
You must be signed in to change notification settings - Fork 437
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
45 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# author: Higor Santos de Brito Dantas | ||
# platform: python 2.7 | ||
|
||
string = raw_input() | ||
product = 1 | ||
|
||
for e in string: | ||
product *= ord(e) | ||
|
||
print product | ||
print product |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Spyder Editor | ||
def sum_square_diff(N): | ||
sum1 = 0 | ||
sum2 = 0 | ||
for num in range(1, N+1): | ||
sum1 += num ** 2 | ||
|
||
This is a temporary script file. | ||
""" | ||
for num in range(1, N+1): | ||
sum2 += num | ||
|
||
message = "Pick a number:" | ||
a = input(message) | ||
a = int(a) | ||
sum2 = sum2 ** 2 | ||
return abs(sum1-sum2) | ||
|
||
if a > 10**4: | ||
print("Number needs to be less than 10,000") | ||
N_list = [] | ||
T = int(input()) | ||
|
||
if a <= 10**4: | ||
|
||
#computing the sum of the squares | ||
somma_square = 0 | ||
for i in range(1,a+1): | ||
square1 = i**2 | ||
somma_square1 = somma_square + square1 | ||
somma_square = somma_square1 | ||
|
||
#computing the square of the sum | ||
somma = 0 | ||
for i in range(1,a+1): | ||
somma1 = somma + i | ||
somma = somma1 | ||
square_somma = somma**2 | ||
|
||
#taking the absolute value of the difference | ||
diff = abs(somma_square - square_somma) | ||
print(diff) | ||
|
||
for _ in range(T): | ||
N = int(input()) | ||
N_list.append(N) | ||
|
||
for N in N_list: | ||
print(sum_square_diff(N), end="\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main() | ||
#include<iostream.h> | ||
void main() | ||
{ | ||
cout<<"HELLO WORLD!"<<endl; | ||
return 0; | ||
} | ||
cout<<"Hello world"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
#include <bits/stdc++.h> | ||
using namespace std; | ||
int main(){ | ||
cout<<"Hello World"<<endl; | ||
return 0; | ||
} | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
cout << "Hello world" << endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
def main(): | ||
userInput = input('Enter a string with multiple words: ') | ||
wordsArr = userInput.split(' ') | ||
reversedWord = ''; | ||
for word in reversed(wordsArr): | ||
reversedWord += word + ' ' | ||
print(reversedWord) | ||
def reverse_word(): | ||
s = input("Enter a sentence containing multiple words: ").strip() | ||
s = s.split()[::-1] | ||
print(s) | ||
s = " ".join(s) | ||
return s | ||
|
||
if __name__ == '__main__': | ||
main() | ||
print(reverse_word()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#Get User word | ||
user_input= raw_input("Please input your word ") | ||
#reverse the user input | ||
reverse_user_input =user_input[::-1] | ||
#Print the reverse word | ||
print ("This is reverse of your word : " + reverse_user_input) | ||
s = input().strip(".").split(" ") | ||
s.reverse() | ||
for i in range(len(s)): | ||
if i != (len(s) - 1): | ||
print(s[i],end=" ") | ||
else: | ||
print(s[i],end=".") |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.