CGG

1

votes
1

answer
158

views

Phoenix unique_constraint error while trying to build database

I am following along with Phoenix 1.4 book, and I got to 'Using the Repository Data' section when I tried to put in data into through the terminal to the database I got an error. My IEx session: iex(1)> alias Rumbl.Repo Rumbl.Repo iex(2)> alias Rumbl.Accounts.User Rumbl.Accounts.User iex(3)> Repo.in...
cgg
1

votes
1

answer
58

views

Ecto.Queryable not implemented for User / Phoenix Error

Following along with the Programming Phoenix 1.4 book. The module worked fine when I was using a manual database, but when I tried to switch my accounts.ex file (like the book told me to do), it broke: defmodule Rumbl.Accounts do alias Rumbl.Repo def get_user(id) do Repo.get(User, id) end def get_us...
cgg
0

votes
3

answer
93

views

Dictionary n: n*n, n+1: n+1*n+1

Having trouble creating a dictionary that loops in term of n: n*n, n+1: n+1*n+1, and so on. It has to contain numbers between 1 and 10 in this form. d = dict () for n in range (1,10): dict[n*n] I cannot print the expected output. I have tried with {} as well to make it cleaner with no success (n:n*n...
CGG
-1

votes
2

answer
23

views

Replacing letters for values and adding them up [duplicate]

This question already has an answer here: How to test multiple variables against a value? 19 answers I am trying to replace different letters of the alphabet for a value: vowels are 1; 'b', 'g', 'r' or 'x' are 3 and the rest of the alphabet equals 5 (this is each character). I've tried to use conv...
CGG
2

votes
6

answer
45

views

How do I separate the numbers from an input in order to add them?

I am trying to have the user input a series of numbers (separated by commas) to receive the total of them. I have tried (with no luck): values = input('Input some comma seprated numbers: ') numbersSum = sum(values) print ('sum of list element is : ', numbersSum) values = input('Input some comma sep...
CGG